The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2d423f7671fe452486932c8e41e7d3547afe82aa

commit 2d423f7671fe452486932c8e41e7d3547afe82aa
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2021-01-14 13:38:29 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2021-06-06 18:42:52 +0000

    sysent: allow ABI to disable setid on exec.
    
    Reviewed by:    dchagin
    Tested by:      trasz
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D28154
---
 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 356c30ee030c..b091d6061616 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -778,6 +778,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. */
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to