Users and permissions: accounts, login, enforced file permissions, setuid, su, passwd, doas
The kernel now checks owner/group/other on open, create, unlink, rename, exec and path search; honours set-user-id and set-group-id; restricts kill, mount, reboot and mknod; keeps supplementary groups; and implements chown. devtmpfs nodes carry owners and modes that chmod/chown keep. Terminals run login, the image has root and schos, X starts as the ordinary user. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
This commit is contained in:
parent
b3f72cd95e
commit
020aa6113c
34 changed files with 1342 additions and 120 deletions
24
Makefile
24
Makefile
|
|
@ -161,7 +161,7 @@ KERN_NOENTRY = $(filter-out $(BUILD)/kernel/arch/x86_64/entry.o, $(KERNOBJS))
|
|||
# Third-party software does NOT go here — see ports/.
|
||||
# -----------------------------------------------------------------------
|
||||
ULIB = $(addprefix $(BUILD)/lib/, start.o glue.o usys.o)
|
||||
CMDS = schinit schinitd fbinfo shmtest socktest inputtest nettest reflink schattr ping chvt loadkeys sigtest memfdtest pcitest vgpud schdbg schdbgd resolvconf httpd schmode netecho ldlsd tone hwreport dynhello evtest xready locktest
|
||||
CMDS = schinit schinitd fbinfo shmtest socktest inputtest nettest reflink schattr ping chvt loadkeys sigtest memfdtest pcitest vgpud schdbg schdbgd resolvconf httpd schmode netecho ldlsd tone hwreport dynhello evtest xready locktest su passwd
|
||||
CMDBINS = $(addprefix $(BUILD)/cmd/, $(CMDS))
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
|
@ -879,13 +879,13 @@ $(BUILD)/kernel/kernel: $(BUILD)/kernel/kernel.pass1 $(BUILD)/kernel/ksym.o
|
|||
$(BUILD)/fs-ram.img: $(MKSCHFS) $(ROOT_STAMP)
|
||||
@mkdir -p $(BUILD)
|
||||
@rm -f $@
|
||||
@used=$$($(MKSCHFS) $@ --size 262144 --label schos \
|
||||
@used=$$($(MKSCHFS) $@ --size 262144 --label schos --owners $(AROOT_DIR)/owners \
|
||||
$(RAMDISK_EXCLUDE_ARGS) --sysroot $(ROOT_TREE) | \
|
||||
sed -n 's/^ *\([0-9][0-9]*\) of [0-9][0-9]* blocks used.*/\1/p'); \
|
||||
test -n "$$used" || { echo "fs-ram.img: mkschfs did not say how much it used" >&2; exit 1; }; \
|
||||
rm -f $@; \
|
||||
$(MKSCHFS) $@ --size $$((used + used / 8 + $(RAMDISK_SLACK))) --label schos \
|
||||
$(RAMDISK_EXCLUDE_ARGS) --sysroot $(ROOT_TREE)
|
||||
--owners $(AROOT_DIR)/owners $(RAMDISK_EXCLUDE_ARGS) --sysroot $(ROOT_TREE)
|
||||
|
||||
# The image goes into the kernel as SCFF (include/fs/scff.h): 128 KB chunks,
|
||||
# each its own zstd frame, unpacked by the kernel the first time a block in it
|
||||
|
|
@ -1166,6 +1166,22 @@ $(BUILD)/cmd/xready: cmd/xready/main.c $(MUSLPREFIX)/lib/libc.so $(LINUXHDR)
|
|||
$(MUSLPREFIX)/lib/crt1.o $(MUSLPREFIX)/lib/crti.o $(BUILD)/cmd/xready.o \
|
||||
-L$(MUSLPREFIX)/lib -lc $(PORTEND)
|
||||
|
||||
# su and passwd: musl, for getpwnam and crypt, and static -- they run setuid root,
|
||||
# so there is no loader or library path to be led astray.
|
||||
$(BUILD)/cmd/su: cmd/su/main.c $(MUSLPREFIX)/lib/libc.so
|
||||
@mkdir -p $(BUILD)/cmd
|
||||
$(DYNCC) -fno-pic -c $< -o $(BUILD)/cmd/su.o
|
||||
$(DYNCC) -static -no-pie -nostdlib -o $@ \
|
||||
$(MUSLPREFIX)/lib/crt1.o $(MUSLPREFIX)/lib/crti.o $(BUILD)/cmd/su.o \
|
||||
-L$(MUSLPREFIX)/lib -lc $(PORTEND)
|
||||
|
||||
$(BUILD)/cmd/passwd: cmd/passwd/main.c $(MUSLPREFIX)/lib/libc.so
|
||||
@mkdir -p $(BUILD)/cmd
|
||||
$(DYNCC) -fno-pic -c $< -o $(BUILD)/cmd/passwd.o
|
||||
$(DYNCC) -static -no-pie -nostdlib -o $@ \
|
||||
$(MUSLPREFIX)/lib/crt1.o $(MUSLPREFIX)/lib/crti.o $(BUILD)/cmd/passwd.o \
|
||||
-L$(MUSLPREFIX)/lib -lc $(PORTEND)
|
||||
|
||||
$(BUILD)/cmd/locktest: cmd/locktest/main.c $(MUSLPREFIX)/lib/libc.so
|
||||
@mkdir -p $(BUILD)/cmd
|
||||
$(DYNCC) -fno-pic -c $< -o $(BUILD)/cmd/locktest.o
|
||||
|
|
@ -1692,7 +1708,7 @@ SCHFS_BLOCKS ?= 262144
|
|||
$(BUILD)/schfs.img: $(MKSCHFS) $(ROOT_STAMP)
|
||||
@mkdir -p $(BUILD)
|
||||
@rm -f $@
|
||||
./$(MKSCHFS) $@ --size $(SCHFS_BLOCKS) --label schos --sysroot $(ROOT_TREE)
|
||||
./$(MKSCHFS) $@ --size $(SCHFS_BLOCKS) --label schos --owners $(AROOT_DIR)/owners --sysroot $(ROOT_TREE)
|
||||
|
||||
# --- The apk-managed root ------------------------------------------------------
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in a new issue