SchOS/kernel/sys
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 51983144e3 exec: Linux's 2 MB of arguments; mmap: merge neighbouring mappings
exec took 32 arguments and 64 environment variables, in fixed arrays,
so a glob over more than 31 files failed with E2BIG. It now reads the
caller's argv and envp where they are, through the uaccess helpers and
a bounce page -- a second thread rewriting the array after a check
cannot slip a kernel address in -- and sizes the new stack to fit
them. The limits are Linux's: ARG_MAX, 2 MB of strings and pointers,
and 128 KB for any one string (USER_STR_MAX follows it).

Every mmap took one of a process's 256 VMA slots, and zsh takes one per
16 KB heap block, so `x=($(<file))` over 30000 words ran out after 4 MB
of heap and exited 1 without a word. Neighbouring anonymous mappings
now share a record, as Linux merges them -- the bump allocator puts
each new one where the last ended -- and munmap trims or splits it.
Partial unmaps of device or segment mappings are refused with EINVAL
instead of kfree()ing pages that are not the process's, and a failed
allocation half way through a mapping no longer leaks what it had.

Checked under QEMU: touch over 3000 names, /bin/echo with 50000
arguments, E2BIG past 2 MB, zsh splitting 100000 words, fork loops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
2026-10-23 13:20:29 +02:00
..
linux_abi.c licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0 2026-10-22 08:48:45 +02:00
sys_compat.c root: find the filesystem instead of being told at build time, and fix dmesg 2026-09-22 01:24:34 +02:00
sys_fs.c exec: Linux's 2 MB of arguments; mmap: merge neighbouring mappings 2026-10-23 13:20:29 +02:00
sys_mem.c exec: Linux's 2 MB of arguments; mmap: merge neighbouring mappings 2026-10-23 13:20:29 +02:00
sys_net.c unix: a bound socket is a file 2026-09-22 10:06:10 +02:00
sys_poll.c kernel: the clock ran 7x slow because the GPU never acknowledged its interrupt 2026-09-12 21:34:36 +02:00
sys_proc.c hwreport: describe a machine onto a USB stick, from a Linux-style /sys 2026-10-23 12:54:11 +02:00
sys_sig.c signal: the return trampoline was Linux-only, and a test that proves the rest 2026-09-21 23:56:34 +02:00
sys_time.c kernel: the clock ran 7x slow because the GPU never acknowledged its interrupt 2026-09-12 21:34:36 +02:00
syscall.c Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
table.inc memfd: a shared memory object you reach by descriptor 2026-09-22 09:47:31 +02:00