git: Implement the fexecve(2) system call

Aaron LI aly at crater.dragonflybsd.org
Sat Feb 20 06:49:38 PST 2021


commit 337acc4483de8c3f37e3efcda91cad4249ba6d61
Author: Aaron LI <aly at aaronly.me>
Date:   Wed Feb 17 20:29:36 2021 +0800

    Implement the fexecve(2) system call
    
    The fexecve(2) function is equivalent to execve(2), except that the file
    to be executed is determined by the file descriptor fd instead of a
    pathname.
    
    The purpose of fexecve(2) is to enable executing a file which has been
    verified to be the intended file.  It is possible to actively check the
    file by reading from the file descriptor and be sure that the file is
    not exchanged for another between the reading and the execution.
    
    See https://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html
    
    This work is partially based on swildner's patch and FreeBSD's
    implementation (revisions 177787, 182191, 238220).
    
    XXX: We're missing O_EXEC support in open(2).
    
    Reviewed-by: dillon

Summary of changes:
 include/unistd.h          |   2 -
 lib/libc/sys/Makefile.inc |   1 +
 lib/libc/sys/Symbol.map   |   3 ++
 lib/libc/sys/execve.2     |  71 ++++++++++++++++++++++++++---
 lib/libc/sys/open.2       |   4 +-
 sys/kern/init_sysent.c    |   1 +
 sys/kern/kern_exec.c      | 114 ++++++++++++++++++++++++++++++++++++++--------
 sys/kern/syscalls.c       |   1 +
 sys/kern/syscalls.master  |   1 +
 sys/sys/kern_syscall.h    |   3 +-
 sys/sys/param.h           |   3 +-
 sys/sys/syscall.h         |   3 +-
 sys/sys/syscall.mk        |   3 +-
 sys/sys/sysproto.h        |   6 +++
 sys/sys/sysunion.h        |   1 +
 15 files changed, 182 insertions(+), 35 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/337acc4483de8c3f37e3efcda91cad4249ba6d61


-- 
DragonFly BSD source repository


More information about the Commits mailing list