kernel: chroot, #! scripts, rename and mmap as apk needs them
Found by running Alpine's apk on SchOS, one failure at a time: - chroot(2) was a stub returning EPERM. Each process now has a root: where an absolute path starts and where .. stops. Mounts remember whose root they were made under, and a walk leaves a mount by the way it came in, so one filesystem can be mounted twice. - devtmpfs and proc mounted only on /dev and /proc, whatever the target; a chroot got "already mounted". - mmap never reused freed address space, so musl's malloc used up the 256 mapping records while 780 MB were free. A mergeable mapping now goes straight after an anonymous one whose end has room. - unlinkat returned -1 (EPERM) where apk expects ENOENT, and renameat was an old copy of rename: no replacing the target, and v1 dirents written into SchFS. Both now share rename's implementation. - execve runs #! scripts, and says ENOEXEC for what it cannot run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
6f3175d8a5
commit
2cfa3f0bf2
9 changed files with 361 additions and 129 deletions
|
|
@ -339,8 +339,8 @@ int procwrite(struct inode*, uint64, char*, int);
|
|||
// namespace, the other the content.
|
||||
int proc_gen_global(int id, char *buf, int cap);
|
||||
int proc_write_sysrq(int user_src, uint64 src, uint n);
|
||||
void procfs_mount(void);
|
||||
void devfs_mount(void);
|
||||
int procfs_mount(const char *target);
|
||||
int devfs_mount(const char *target);
|
||||
|
||||
// input.c -- raw evdev event devices
|
||||
void inputinit(void);
|
||||
|
|
|
|||
|
|
@ -313,6 +313,10 @@ struct proc {
|
|||
// rt_sigreturn. See "The FPU" above scheduler() in kernel/proc/proc.c.
|
||||
uint8 fpu[512] __attribute__((aligned(16)));
|
||||
uint8 sigfpu[512] __attribute__((aligned(16)));
|
||||
|
||||
// chroot(2): where an absolute path starts, and where ".." stops. 0 is the
|
||||
// system's root. Inherited across fork, held as a reference like cwd.
|
||||
struct inode *root;
|
||||
};
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue