public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH,RFC 0/9] SCFI implementation in GNU assembler
@ 2023-09-20 23:03 Indu Bhagat
  2023-09-20 23:03 ` [PATCH,RFC 1/9] gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections Indu Bhagat
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Indu Bhagat @ 2023-09-20 23:03 UTC (permalink / raw)
  To: binutils; +Cc: Indu Bhagat

Hello,

This is an RFC patch series for the implementation in GNU assembler to
synthesize CFI, a.k.a. SCFI, for hand-written asm.

The motivation for this work is to relieve the users from the need to manually
add CFI annotations for most hand-written asm.  Manually adding CFI annotations to
assembly programs needs additional expertise; human-errors are possible and
indeed occur more often than one may like. These errors, if present at the time
of virtual stack unwind, lead to unfavorable outcomes: incorrect stacktraces,
program state corruption etc.

The implementation is in progress, but I think its a good point to get some
feedback.  We will also be talking about this at the GNU Tools Cauldron 2023,
so one more reason to share the current state of the implemenation.  For
further details on the design and implementation, open issues, and next
steps, please refer to the notes sent earlier in a separate document
(https://sourceware.org/pipermail/binutils/2023-September/129558.html).

The first two patches are orthogonal to SCFI implementation, but do provide
some sanitization of interfaces so that the SCFI machinery can reuse the
functionality in dw2gencfi:

  gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections
  gas: dw2gencfi: use all_cfi_sections instead of cfi_sections

The other seven patches pertain to SCFI implmentation.

The SCFI implementation is enabled only for the x86 backend at this time. 

Thanks,
Indu Bhagat (9):
  gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections
  gas: dw2gencfi: use all_cfi_sections instead of cfi_sections
  gas: dw2gencfi: expose a new cfi_set_last_fde API
  gas: dw2gencfi: move some tc_* defines to the header file
  gas: add new command line option --scfi[=all,none]
  gas: dw2gencfi: ignore all .cfi_* directives with --scfi=all
  gas: scfidw2gen: new functionality to prepapre for SCFI
  gas: synthesize CFI for hand-written asm
  gas: testsuite: add a x86_64 testsuite for SCFI

 gas/Makefile.am                               |    6 +
 gas/Makefile.in                               |   18 +-
 gas/as.c                                      |   20 +-
 gas/as.h                                      |    8 +
 gas/config/obj-elf.c                          |    8 +
 gas/config/tc-i386.c                          |  646 +++++++++-
 gas/config/tc-i386.h                          |   21 +
 gas/doc/as.texi                               |    5 +
 gas/dw2gencfi.c                               |  114 +-
 gas/dw2gencfi.h                               |   14 +
 gas/ginsn.c                                   |  985 +++++++++++++++
 gas/ginsn.h                                   |  347 ++++++
 gas/scfi.c                                    | 1090 +++++++++++++++++
 gas/scfi.h                                    |   31 +
 gas/scfidw2gen.c                              |  185 +++
 gas/scfidw2gen.h                              |   35 +
 gas/subsegs.h                                 |    2 +
 gas/symbols.c                                 |    3 +
 gas/testsuite/gas/scfi/README                 |   11 +
 gas/testsuite/gas/scfi/x86_64/scfi-add-1.d    |   25 +
 gas/testsuite/gas/scfi/x86_64/scfi-add-1.s    |   13 +
 gas/testsuite/gas/scfi/x86_64/scfi-add-2.d    |   36 +
 gas/testsuite/gas/scfi/x86_64/scfi-add-2.s    |   43 +
 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d  |   31 +
 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s  |   22 +
 .../gas/scfi/x86_64/scfi-callee-saved-1.d     |   40 +
 .../gas/scfi/x86_64/scfi-callee-saved-1.s     |   26 +
 .../gas/scfi/x86_64/scfi-callee-saved-2.d     |   41 +
 .../gas/scfi/x86_64/scfi-callee-saved-2.s     |   42 +
 .../gas/scfi/x86_64/scfi-callee-saved-3.d     |   42 +
 .../gas/scfi/x86_64/scfi-callee-saved-3.s     |   40 +
 .../gas/scfi/x86_64/scfi-callee-saved-4.d     |   40 +
 .../gas/scfi/x86_64/scfi-callee-saved-4.s     |   55 +
 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d    |   36 +
 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s    |   47 +
 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d    |   28 +
 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s    |   21 +
 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d   |    5 +
 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s   |   20 +
 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l   |    3 +
 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s   |   23 +
 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l   |    3 +
 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s   |   28 +
 .../gas/scfi/x86_64/scfi-dyn-stack-1.d        |   23 +
 .../gas/scfi/x86_64/scfi-dyn-stack-1.s        |   50 +
 .../gas/scfi/x86_64/scfi-fp-diag-2.l          |    2 +
 .../gas/scfi/x86_64/scfi-fp-diag-2.s          |   55 +
 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d |   26 +
 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s |   13 +
 .../gas/scfi/x86_64/scfi-indirect-mov-1.d     |   51 +
 .../gas/scfi/x86_64/scfi-indirect-mov-1.s     |   48 +
 .../gas/scfi/x86_64/scfi-indirect-mov-2.d     |   41 +
 .../gas/scfi/x86_64/scfi-indirect-mov-2.s     |   38 +
 .../gas/scfi/x86_64/scfi-indirect-mov-3.d     |   41 +
 .../gas/scfi/x86_64/scfi-indirect-mov-3.s     |   38 +
 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d    |   37 +
 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s    |   40 +
 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d  |   36 +
 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s  |   26 +
 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d  |   35 +
 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s  |   24 +
 .../gas/scfi/x86_64/scfi-selfalign-func-1.d   |   31 +
 .../gas/scfi/x86_64/scfi-selfalign-func-1.s   |   36 +
 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d |   26 +
 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s |    9 +
 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d |   30 +
 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s |   16 +
 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d    |   25 +
 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s    |   12 +
 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d    |   31 +
 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s    |   23 +
 .../gas/scfi/x86_64/scfi-unsupported-1.l      |    2 +
 .../gas/scfi/x86_64/scfi-unsupported-1.s      |   10 +
 .../gas/scfi/x86_64/scfi-unsupported-2.l      |    3 +
 .../gas/scfi/x86_64/scfi-unsupported-2.s      |   14 +
 .../gas/scfi/x86_64/scfi-unsupported-cfg-1.l  |    2 +
 .../gas/scfi/x86_64/scfi-unsupported-cfg-1.s  |   53 +
 .../gas/scfi/x86_64/scfi-unsupported-drap-1.l |    3 +
 .../gas/scfi/x86_64/scfi-unsupported-drap-1.s |   75 ++
 gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp |   59 +
 80 files changed, 5311 insertions(+), 32 deletions(-)
 create mode 100644 gas/ginsn.c
 create mode 100644 gas/ginsn.h
 create mode 100644 gas/scfi.c
 create mode 100644 gas/scfi.h
 create mode 100644 gas/scfidw2gen.c
 create mode 100644 gas/scfidw2gen.h
 create mode 100644 gas/testsuite/gas/scfi/README
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s
 create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp

-- 
2.41.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-09-30  6:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 23:03 [PATCH,RFC 0/9] SCFI implementation in GNU assembler Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 1/9] gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 2/9] gas: dw2gencfi: use all_cfi_sections instead of cfi_sections Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 3/9] gas: dw2gencfi: expose a new cfi_set_last_fde API Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 4/9] gas: dw2gencfi: move some tc_* defines to the header file Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 5/9] gas: add new command line option --scfi[=all,none] Indu Bhagat
2023-09-28 14:04   ` Nick Clifton
2023-09-30  6:13     ` Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 6/9] gas: dw2gencfi: ignore all .cfi_* directives with --scfi=all Indu Bhagat
2023-09-28 14:10   ` [PATCH, RFC " Nick Clifton
2023-09-30  6:20     ` Indu Bhagat
2023-09-20 23:03 ` [PATCH,RFC 7/9] gas: scfidw2gen: new functionality to prepapre for SCFI Indu Bhagat
2023-09-20 23:04 ` [PATCH,RFC 8/9] gas: synthesize CFI for hand-written asm Indu Bhagat
2023-09-28 14:58   ` Nick Clifton
2023-09-30  6:43     ` Indu Bhagat
2023-09-20 23:04 ` [PATCH,RFC 9/9] gas: testsuite: add a x86_64 testsuite for SCFI Indu Bhagat
2023-09-28 15:01 ` [PATCH,RFC 0/9] SCFI implementation in GNU assembler Nick Clifton
2023-09-30  6:44   ` Indu Bhagat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).