git: 7893419d492c - main - Remove never implemented sbrk and sstk syscalls
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 04 Dec 2023 21:02:32 UTC
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=7893419d492c40ca82b68fca3dcc0f5f7047d39b commit 7893419d492c40ca82b68fca3dcc0f5f7047d39b Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2023-12-04 20:36:08 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2023-12-04 20:36:08 +0000 Remove never implemented sbrk and sstk syscalls Both system calls were stubs returning EOPNOTSUPP and libc did not provide _ or __sys_ prefixed symbols. The actual implementation of sbrk(2) is on top of the undocumented break(2) system call. Technically this is a change in ABI, but no non-contrived program ever called these syscalls. Reviewed by: kib, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42872 --- lib/libc/aarch64/sys/Makefile.inc | 3 +- lib/libc/amd64/sys/Makefile.inc | 2 +- lib/libc/arm/sys/Makefile.inc | 2 +- lib/libc/i386/sys/Makefile.inc | 2 +- lib/libc/riscv/sys/Makefile.inc | 2 +- lib/libc/sys/Makefile.inc | 1 - sys/compat/freebsd32/freebsd32_syscall.h | 4 +-- sys/compat/freebsd32/freebsd32_syscalls.c | 4 +-- sys/compat/freebsd32/freebsd32_sysent.c | 4 +-- sys/compat/freebsd32/freebsd32_systrace_args.c | 44 -------------------------- sys/kern/init_sysent.c | 4 +-- sys/kern/syscalls.c | 4 +-- sys/kern/syscalls.master | 12 ++----- sys/kern/systrace_args.c | 44 -------------------------- sys/sys/syscall.h | 4 +-- sys/sys/syscall.mk | 2 -- sys/sys/sysproto.h | 10 ------ sys/vm/vm_mmap.c | 26 --------------- 18 files changed, 19 insertions(+), 155 deletions(-) diff --git a/lib/libc/aarch64/sys/Makefile.inc b/lib/libc/aarch64/sys/Makefile.inc index 7cb0544a2997..ae48fd739477 100644 --- a/lib/libc/aarch64/sys/Makefile.inc +++ b/lib/libc/aarch64/sys/Makefile.inc @@ -8,5 +8,4 @@ MDASM= cerror.S \ vfork.S # Don't generate default code for these syscalls: -NOASM+= sbrk.o \ - vfork.o +NOASM+= vfork.o diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc index 32c03ccf2963..658fbd2add50 100644 --- a/lib/libc/amd64/sys/Makefile.inc +++ b/lib/libc/amd64/sys/Makefile.inc @@ -7,4 +7,4 @@ SRCS+= \ MDASM= vfork.S cerror.S getcontext.S # Don't generate default code for these syscalls: -NOASM+= sbrk.o vfork.o +NOASM+= vfork.o diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc index 398ac494f2bc..3a86936a7b23 100644 --- a/lib/libc/arm/sys/Makefile.inc +++ b/lib/libc/arm/sys/Makefile.inc @@ -4,4 +4,4 @@ SRCS+= __vdso_gettc.c \ MDASM= Ovfork.S cerror.S syscall.S # Don't generate default code for these syscalls: -NOASM+= sbrk.o vfork.o +NOASM+= vfork.o diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc index accdc3367ac8..57a8af428aca 100644 --- a/lib/libc/i386/sys/Makefile.inc +++ b/lib/libc/i386/sys/Makefile.inc @@ -4,7 +4,7 @@ SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ MDASM= Ovfork.S cerror.S getcontext.S syscall.S -NOASM+= sbrk.o vfork.o +NOASM+= vfork.o MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2 MAN+= i386_set_watch.3 diff --git a/lib/libc/riscv/sys/Makefile.inc b/lib/libc/riscv/sys/Makefile.inc index f1cc8d489553..cd8ba4f11557 100644 --- a/lib/libc/riscv/sys/Makefile.inc +++ b/lib/libc/riscv/sys/Makefile.inc @@ -6,4 +6,4 @@ MDASM= cerror.S \ vfork.S # Don't generate default code for these syscalls: -NOASM+= sbrk.o vfork.o +NOASM+= vfork.o diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 0491f8227de6..b9ac43bac077 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -17,7 +17,6 @@ # NOASM= exit.o \ getlogin.o \ - sstk.o \ yield.o PSEUDO= _exit.o \ _getlogin.o diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index 3123c3b1f74c..bc824b8e04be 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -73,8 +73,8 @@ #define FREEBSD32_SYS_vfork 66 /* 67 is obsolete vread */ /* 68 is obsolete vwrite */ -#define FREEBSD32_SYS_sbrk 69 -#define FREEBSD32_SYS_sstk 70 + /* 69 is obsolete sbrk */ + /* 70 is obsolete sstk */ /* 71 is old freebsd32_mmap */ #define FREEBSD32_SYS_freebsd11_vadvise 72 #define FREEBSD32_SYS_munmap 73 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index e64c36b32d00..3e7656cace72 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -74,8 +74,8 @@ const char *freebsd32_syscallnames[] = { "vfork", /* 66 = vfork */ "obs_vread", /* 67 = obsolete vread */ "obs_vwrite", /* 68 = obsolete vwrite */ - "sbrk", /* 69 = sbrk */ - "sstk", /* 70 = sstk */ + "obs_sbrk", /* 69 = obsolete sbrk */ + "obs_sstk", /* 70 = obsolete sstk */ "compat.freebsd32_mmap", /* 71 = old freebsd32_mmap */ "compat11.vadvise", /* 72 = freebsd11 vadvise */ "munmap", /* 73 = munmap */ diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 2bb45fc3d2e2..179d83186b41 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -130,8 +130,8 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)sys_vfork, .sy_auevent = AUE_VFORK, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 66 = vfork */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 67 = obsolete vread */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 68 = obsolete vwrite */ - { .sy_narg = AS(sbrk_args), .sy_call = (sy_call_t *)sys_sbrk, .sy_auevent = AUE_SBRK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 69 = sbrk */ - { .sy_narg = AS(sstk_args), .sy_call = (sy_call_t *)sys_sstk, .sy_auevent = AUE_SSTK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 70 = sstk */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 69 = obsolete sbrk */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 70 = obsolete sstk */ { compat(AS(ofreebsd32_mmap_args),freebsd32_mmap), .sy_auevent = AUE_MMAP, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 71 = old freebsd32_mmap */ { compat11(AS(freebsd11_vadvise_args),vadvise), .sy_auevent = AUE_O_VADVISE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 72 = freebsd11 vadvise */ { .sy_narg = AS(munmap_args), .sy_call = (sy_call_t *)sys_munmap, .sy_auevent = AUE_MUNMAP, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 73 = munmap */ diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index fb1fddc6ae5e..0d263b57bf0f 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -421,20 +421,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } - /* sbrk */ - case 69: { - struct sbrk_args *p = params; - iarg[a++] = p->incr; /* int */ - *n_args = 1; - break; - } - /* sstk */ - case 70: { - struct sstk_args *p = params; - iarg[a++] = p->incr; /* int */ - *n_args = 1; - break; - } /* munmap */ case 73: { struct munmap_args *p = params; @@ -4009,26 +3995,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* vfork */ case 66: break; - /* sbrk */ - case 69: - switch (ndx) { - case 0: - p = "int"; - break; - default: - break; - }; - break; - /* sstk */ - case 70: - switch (ndx) { - case 0: - p = "int"; - break; - default: - break; - }; - break; /* munmap */ case 73: switch (ndx) { @@ -9347,16 +9313,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* vfork */ case 66: - /* sbrk */ - case 69: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* sstk */ - case 70: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* munmap */ case 73: if (ndx == 0 || ndx == 1) diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index d44fec54fcd7..74b96a27b3fa 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -129,8 +129,8 @@ struct sysent sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)sys_vfork, .sy_auevent = AUE_VFORK, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 66 = vfork */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 67 = obsolete vread */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 68 = obsolete vwrite */ - { .sy_narg = AS(sbrk_args), .sy_call = (sy_call_t *)sys_sbrk, .sy_auevent = AUE_SBRK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 69 = sbrk */ - { .sy_narg = AS(sstk_args), .sy_call = (sy_call_t *)sys_sstk, .sy_auevent = AUE_SSTK, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 70 = sstk */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 69 = obsolete sbrk */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 70 = obsolete sstk */ { compat(AS(ommap_args),mmap), .sy_auevent = AUE_MMAP, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 71 = old mmap */ { compat11(AS(freebsd11_vadvise_args),vadvise), .sy_auevent = AUE_O_VADVISE, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 72 = freebsd11 vadvise */ { .sy_narg = AS(munmap_args), .sy_call = (sy_call_t *)sys_munmap, .sy_auevent = AUE_MUNMAP, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 73 = munmap */ diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 8f13ccb186ee..323669158ac4 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -74,8 +74,8 @@ const char *syscallnames[] = { "vfork", /* 66 = vfork */ "obs_vread", /* 67 = obsolete vread */ "obs_vwrite", /* 68 = obsolete vwrite */ - "sbrk", /* 69 = sbrk */ - "sstk", /* 70 = sstk */ + "obs_sbrk", /* 69 = obsolete sbrk */ + "obs_sstk", /* 70 = obsolete sstk */ "compat.mmap", /* 71 = old mmap */ "compat11.vadvise", /* 72 = freebsd11 vadvise */ "munmap", /* 73 = munmap */ diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 63aa8c2a5d7e..709b01f0abbe 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -502,16 +502,8 @@ } 67 AUE_NULL OBSOL vread 68 AUE_NULL OBSOL vwrite -69 AUE_SBRK STD|CAPENABLED { - int sbrk( - int incr - ); - } -70 AUE_SSTK STD|CAPENABLED { - int sstk( - int incr - ); - } +69 AUE_NULL OBSOL sbrk +70 AUE_NULL OBSOL sstk 71 AUE_MMAP COMPAT|CAPENABLED { void *mmap( _In_ void *addr, diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 1b14b68c84d1..5166223fe8c6 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -418,20 +418,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 0; break; } - /* sbrk */ - case 69: { - struct sbrk_args *p = params; - iarg[a++] = p->incr; /* int */ - *n_args = 1; - break; - } - /* sstk */ - case 70: { - struct sstk_args *p = params; - iarg[a++] = p->incr; /* int */ - *n_args = 1; - break; - } /* munmap */ case 73: { struct munmap_args *p = params; @@ -4096,26 +4082,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) /* vfork */ case 66: break; - /* sbrk */ - case 69: - switch (ndx) { - case 0: - p = "int"; - break; - default: - break; - }; - break; - /* sstk */ - case 70: - switch (ndx) { - case 0: - p = "int"; - break; - default: - break; - }; - break; /* munmap */ case 73: switch (ndx) { @@ -9492,16 +9458,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* vfork */ case 66: - /* sbrk */ - case 69: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* sstk */ - case 70: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* munmap */ case 73: if (ndx == 0 || ndx == 1) diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 724ca454dbf7..cdc09a0edc29 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -73,8 +73,8 @@ #define SYS_vfork 66 /* 67 is obsolete vread */ /* 68 is obsolete vwrite */ -#define SYS_sbrk 69 -#define SYS_sstk 70 + /* 69 is obsolete sbrk */ + /* 70 is obsolete sstk */ /* 71 is old mmap */ #define SYS_freebsd11_vadvise 72 #define SYS_munmap 73 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index ef58619ea6d4..8c85dc4c349c 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -56,8 +56,6 @@ MIASM = \ chroot.o \ msync.o \ vfork.o \ - sbrk.o \ - sstk.o \ freebsd11_vadvise.o \ munmap.o \ mprotect.o \ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 374f5c7d6065..803144745a76 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -254,12 +254,6 @@ struct msync_args { struct vfork_args { syscallarg_t dummy; }; -struct sbrk_args { - char incr_l_[PADL_(int)]; int incr; char incr_r_[PADR_(int)]; -}; -struct sstk_args { - char incr_l_[PADL_(int)]; int incr; char incr_r_[PADR_(int)]; -}; struct munmap_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; @@ -1928,8 +1922,6 @@ int sys_umask(struct thread *, struct umask_args *); int sys_chroot(struct thread *, struct chroot_args *); int sys_msync(struct thread *, struct msync_args *); int sys_vfork(struct thread *, struct vfork_args *); -int sys_sbrk(struct thread *, struct sbrk_args *); -int sys_sstk(struct thread *, struct sstk_args *); int sys_munmap(struct thread *, struct munmap_args *); int sys_mprotect(struct thread *, struct mprotect_args *); int sys_madvise(struct thread *, struct madvise_args *); @@ -2838,8 +2830,6 @@ int freebsd13_swapoff(struct thread *, struct freebsd13_swapoff_args *); #define SYS_AUE_ogetpagesize AUE_NULL #define SYS_AUE_msync AUE_MSYNC #define SYS_AUE_vfork AUE_VFORK -#define SYS_AUE_sbrk AUE_SBRK -#define SYS_AUE_sstk AUE_SSTK #define SYS_AUE_ommap AUE_MMAP #define SYS_AUE_freebsd11_vadvise AUE_O_VADVISE #define SYS_AUE_munmap AUE_MUNMAP diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index b95f611ef758..4f709b1b74e1 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -106,32 +106,6 @@ SYSCTL_INT(_vm, OID_AUTO, imply_prot_max, CTLFLAG_RWTUN, &imply_prot_max, 0, _Static_assert(MAXPAGESIZES <= 4, "MINCORE_SUPER too narrow"); -#ifndef _SYS_SYSPROTO_H_ -struct sbrk_args { - int incr; -}; -#endif - -int -sys_sbrk(struct thread *td, struct sbrk_args *uap) -{ - /* Not yet implemented */ - return (EOPNOTSUPP); -} - -#ifndef _SYS_SYSPROTO_H_ -struct sstk_args { - int incr; -}; -#endif - -int -sys_sstk(struct thread *td, struct sstk_args *uap) -{ - /* Not yet implemented */ - return (EOPNOTSUPP); -} - #if defined(COMPAT_43) int ogetpagesize(struct thread *td, struct ogetpagesize_args *uap)