diff options
author | Todd Mortimer <mortimer@cvs.openbsd.org> | 2023-01-11 01:55:18 +0000 |
---|---|---|
committer | Todd Mortimer <mortimer@cvs.openbsd.org> | 2023-01-11 01:55:18 +0000 |
commit | 19d9b9820637a3d2e5b710841dbf3ab7eeefe8f8 (patch) | |
tree | 58accc4b54e89c77dd78bdd5c83fcb778ae51349 /libexec | |
parent | 2f8c2da4ef01a213b652b3ee4d7317c627ca268b (diff) |
Add retguard to amd64 syscalls.
Since we got rid of padded syscalls we have enough registers to do this.
ok deraadt@ ok kettenis@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/amd64/SYS.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libexec/ld.so/amd64/SYS.h b/libexec/ld.so/amd64/SYS.h index 724c9f5521b..ed1f20725c1 100644 --- a/libexec/ld.so/amd64/SYS.h +++ b/libexec/ld.so/amd64/SYS.h @@ -1,4 +1,4 @@ -/* $OpenBSD: SYS.h,v 1.1 2017/08/27 21:59:52 deraadt Exp $ */ +/* $OpenBSD: SYS.h,v 1.2 2023/01/11 01:55:17 mortimer Exp $ */ /* * Copyright (c) 2002,2004 Dale Rahn @@ -35,10 +35,13 @@ .type __CONCAT(_dl_,n), @function ;\ .align 16,0xcc ;\ __CONCAT(_dl_,n): ;\ + RETGUARD_SETUP(_dl_##n, r11) ;\ + RETGUARD_PUSH(r11) ;\ movl $(__CONCAT(SYS_,n)), %eax ;\ movq %rcx, %r10 ;\ syscall ;\ - jb 1f ;\ - ret ;\ -1: neg %rax ;\ + jnc 1f ;\ + neg %rax ;\ +1: RETGUARD_POP(r11) ;\ + RETGUARD_CHECK(_dl_##n, r11) ;\ ret |