mirror of
https://github.com/opnsense/src.git
synced 2026-06-05 14:54:21 -04:00
sysentvec: add SV_SIGSYS flag
to allow ABIs to indicate that SIGSYS is needed. Mark all native FreeBSD ABIs with the flag. This implicitly marks Linux' ABIs as not delivering SIGSYS on invalid syscall. Reviewed by: dchagin, markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41976
This commit is contained in:
parent
39024a8914
commit
b82b4ae752
12 changed files with 24 additions and 17 deletions
|
|
@ -80,7 +80,8 @@ struct sysentvec elf64_freebsd_sysvec_la48 = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP |
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG,
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG |
|
||||
SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
@ -122,7 +123,8 @@ struct sysentvec elf64_freebsd_sysvec_la57 = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP |
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG,
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG |
|
||||
SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
.sv_maxssiz = NULL,
|
||||
.sv_flags =
|
||||
SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER |
|
||||
SV_ABI_FREEBSD | SV_ILP32,
|
||||
SV_ABI_FREEBSD | SV_ILP32 | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static struct sysentvec elf32_freebsd_sysvec = {
|
|||
.sv_fixlimit = NULL, // XXX
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_TIMEKEEP |
|
||||
SV_RNG_SEED_VER,
|
||||
SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = freebsd32_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = freebsd32_fetch_syscall_args,
|
||||
.sv_syscallnames = freebsd32_syscallnames,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_SHP | SV_TIMEKEEP | SV_ABI_FREEBSD | SV_LP64 |
|
||||
SV_ASLR | SV_RNG_SEED_VER,
|
||||
SV_ASLR | SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ struct sysentvec ia32_freebsd_sysvec = {
|
|||
.sv_fixlimit = ia32_fixlimit,
|
||||
.sv_maxssiz = &ia32_maxssiz,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_IA32 | SV_ILP32 |
|
||||
SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG,
|
||||
SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER |
|
||||
SV_DSO_SIG | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = ia32_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = ia32_fetch_syscall_args,
|
||||
.sv_syscallnames = freebsd32_syscallnames,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_IA32 | SV_ILP32 |
|
||||
SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER,
|
||||
SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ struct sysentvec aout_sysvec = {
|
|||
.sv_setregs = exec_setregs,
|
||||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32 |
|
||||
SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
@ -140,7 +141,8 @@ struct sysentvec aout_sysvec = {
|
|||
.sv_setregs = ia32_setregs,
|
||||
.sv_fixlimit = ia32_fixlimit,
|
||||
.sv_maxssiz = &ia32_maxssiz,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_AOUT | SV_IA32 | SV_ILP32 |
|
||||
SV_SIGSYS,
|
||||
.sv_set_syscall_retval = ia32_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = ia32_fetch_syscall_args,
|
||||
.sv_syscallnames = freebsd32_syscallnames,
|
||||
|
|
|
|||
|
|
@ -4219,9 +4219,11 @@ nosys(struct thread *td, struct nosys_args *args)
|
|||
|
||||
p = td->td_proc;
|
||||
|
||||
PROC_LOCK(p);
|
||||
tdsignal(td, SIGSYS);
|
||||
PROC_UNLOCK(p);
|
||||
if (SV_PROC_FLAG(p, SV_SIGSYS) != 0) {
|
||||
PROC_LOCK(p);
|
||||
tdsignal(td, SIGSYS);
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
if (kern_lognosys == 1 || kern_lognosys == 3) {
|
||||
uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
|
||||
td->td_sa.code);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
|||
#endif
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_ASLR |
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER,
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ struct sysentvec elf64_freebsd_sysvec_v1 = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR |
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER,
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
@ -128,7 +128,7 @@ struct sysentvec elf64_freebsd_sysvec_v2 = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP |
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER,
|
||||
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
|||
.sv_fixlimit = NULL,
|
||||
.sv_maxssiz = NULL,
|
||||
.sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP |
|
||||
SV_ASLR | SV_RNG_SEED_VER,
|
||||
SV_ASLR | SV_RNG_SEED_VER | SV_SIGSYS,
|
||||
.sv_set_syscall_retval = cpu_set_syscall_retval,
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ struct sysentvec {
|
|||
#define SV_IA32 0x004000 /* Intel 32-bit executable. */
|
||||
#define SV_AOUT 0x008000 /* a.out executable. */
|
||||
#define SV_SHP 0x010000 /* Shared page. */
|
||||
#define SV_AVAIL1 0x020000 /* Unused */
|
||||
#define SV_SIGSYS 0x020000 /* SIGSYS for non-existing syscall */
|
||||
#define SV_TIMEKEEP 0x040000 /* Shared page timehands. */
|
||||
#define SV_ASLR 0x080000 /* ASLR allowed. */
|
||||
#define SV_RNG_SEED_VER 0x100000 /* random(4) reseed generation. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue