[v3,0/2] x86_64: aarch64: Set call number just before syscall

Message ID 20230417153451.1450817-1-josimmon@redhat.com
Headers
Series x86_64: aarch64: Set call number just before syscall |

Message

Joe Simmons-Talbott April 17, 2023, 3:34 p.m. UTC
  To make binary call tree analysis easier place the syscall number into
the register just before the syscall is made.  Only do this if the
syscall number is a constant integer.

Compiler optimizations can place quite a few instructions between the
setting of the syscall number and the syscall instruction.  During call
tree analysis the number of instructions between the two can lead to
more difficulty for both tools and humans in properly identifying the
syscall number.  Having the syscall number set in the prior instruction
to the syscall instruction makes this task easier and less error prone.
Being able to reliably identify syscalls made by a given API will make
it easier to understand and verify the safety and security of glibc.

Tested on x86_64 and aarch64.

Changes to v2:
  * Add a more detailed commit message.
  
Changes to v1:
  * aarch64: Combine two inline asms into one.  Avoid loading name twice.

Joe Simmons-Talbott (2):
  x86_64: Set the syscall register right before doing the syscall.
  aarch64: Set the syscall register right before doing the syscall.

 sysdeps/unix/sysv/linux/aarch64/sysdep.h | 20 +++++++++++---
 sysdeps/unix/sysv/linux/x86_64/sysdep.h  | 33 ++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 3 deletions(-)