Multiuser, Capabilities and Access Controls (#54)
authorLunaixsky <lunaixsky@qq.com>
Tue, 1 Apr 2025 19:08:48 +0000 (20:08 +0100)
committerGitHub <noreply@github.com>
Tue, 1 Apr 2025 19:08:48 +0000 (20:08 +0100)
commit0fd474df7001837bde53da0e42e83081827c9641
tree46b6a0c2fdce17abbfc2c8d6c8149387014884d0
parentcbc8fdbfe473e23e19690204418e19999a9522d1
Multiuser, Capabilities and Access Controls (#54)

* basic user, group and capability housekeeping.

add usrscope for process-wise user management
implement {get,set}*{uid,euid,gid,egid,groups} syscalls
basic acl checking mechanism
move common syscall table to arch/generic.

* patch file systems with the acl checks

make sure the user scope is copied upon fork

* syscalls: chroot, fchmodat, fchownat, faccessat

enable access check in path walker
add default directory permission for ramfs and devfs

* release the dnode lock after EACCESS in path walk

make struct stats conforming to POSIX
minor tweaks stock shell environment for better look and feel

* allow specifiying access mode when creating twifs file node

twifs: refactor the interface for easy twimap/twifs export

cake: fix overflow of index guessing when freeing, causing false
positive and possibly failing double free assertion
58 files changed:
README.md
lunaix-os/arch/generic/includes/asm-generic/syscall_nr.inc [new file with mode: 0644]
lunaix-os/arch/x86/LBuild
lunaix-os/arch/x86/syscall32.S
lunaix-os/arch/x86/syscall64.S
lunaix-os/arch/x86/syscall_lut.S [new file with mode: 0644]
lunaix-os/arch/x86/syscall_nr.inc
lunaix-os/hal/ahci/hbadev_export.c
lunaix-os/hal/bus/pci.c
lunaix-os/hal/rtc/rtc_device.c
lunaix-os/includes/lunaix/compiler.h
lunaix-os/includes/lunaix/exec.h
lunaix-os/includes/lunaix/fs.h
lunaix-os/includes/lunaix/fs/api.h
lunaix-os/includes/lunaix/fs/twifs.h
lunaix-os/includes/lunaix/fs/twimap.h
lunaix-os/includes/lunaix/fs_acl.h [new file with mode: 0644]
lunaix-os/includes/lunaix/limits.h [new file with mode: 0644]
lunaix-os/includes/lunaix/process.h
lunaix-os/includes/lunaix/types.h
lunaix-os/includes/lunaix/usercaps.h [new file with mode: 0644]
lunaix-os/includes/lunaix/usrscope.h [new file with mode: 0644]
lunaix-os/includes/usr/lunaix/fcntl_defs.h
lunaix-os/includes/usr/lunaix/status.h
lunaix-os/includes/usr/lunaix/types.h
lunaix-os/kernel/LBuild
lunaix-os/kernel/block/blk_mapping.c
lunaix-os/kernel/device/devdb.c
lunaix-os/kernel/device/devfs.c
lunaix-os/kernel/ds/waitq.c
lunaix-os/kernel/exe/exec.c
lunaix-os/kernel/fs/ext2/ext2.h
lunaix-os/kernel/fs/ext2/inode.c
lunaix-os/kernel/fs/fs_export.c
lunaix-os/kernel/fs/fsm.c
lunaix-os/kernel/fs/iso9660/inode.c
lunaix-os/kernel/fs/iso9660/iso9660.h
lunaix-os/kernel/fs/mount.c
lunaix-os/kernel/fs/path_walk.c
lunaix-os/kernel/fs/ramfs/ramfs.c
lunaix-os/kernel/fs/twifs/twifs.c
lunaix-os/kernel/fs/vfs.c
lunaix-os/kernel/kprint/kprintf.c
lunaix-os/kernel/lrud.c
lunaix-os/kernel/mm/cake.c
lunaix-os/kernel/mm/cake_export.c
lunaix-os/kernel/process/fork.c
lunaix-os/kernel/process/process.c
lunaix-os/kernel/process/sched.c
lunaix-os/kernel/time/clock.c
lunaix-os/kernel/usrscope.c [new file with mode: 0644]
lunaix-os/usr/cat.c
lunaix-os/usr/init/init.c
lunaix-os/usr/libc/src/_vprintf.c
lunaix-os/usr/ls.c
lunaix-os/usr/rm.c
lunaix-os/usr/sh/sh.c
lunaix-os/usr/stat.c