Date: Sun, 13 Jun 2021 01:38:08 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: ff59c9de3274 - stable/13 - sysent: allow ABI to disable setid on exec. Message-ID: <202106130138.15D1c8iA038266@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ff59c9de3274134e3e517a7faf7b5fbedfc0bb7f commit ff59c9de3274134e3e517a7faf7b5fbedfc0bb7f Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-01-14 13:38:29 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-06-13 01:22:32 +0000 sysent: allow ABI to disable setid on exec. (cherry picked from commit 2d423f7671fe452486932c8e41e7d3547afe82aa) --- sys/kern/kern_exec.c | 4 ++++ sys/sys/sysent.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 1df422dec08e..3413a5d024d4 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -774,6 +774,10 @@ interpret: signotify(td); } + if (imgp->sysent->sv_setid_allowed != NULL && + !(*imgp->sysent->sv_setid_allowed)(td, imgp)) + execve_nosetid(imgp); + /* * Implement image setuid/setgid installation. */ diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index e6db2ec3dfb1..4a707b41e020 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -148,6 +148,8 @@ struct sysentvec { void (*sv_onexec)(struct proc *, struct image_params *); void (*sv_onexit)(struct proc *); void (*sv_ontdexit)(struct thread *td); + bool (*sv_setid_allowed)(struct thread *td, + struct image_params *imgp); }; #define SV_ILP32 0x000100 /* 32-bit executable. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106130138.15D1c8iA038266>