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
|
|
@ -180,6 +180,10 @@ void mountinit(void);
|
|||
// 1 if the filesystem on this device refuses writes -- a mounted snapshot.
|
||||
// Ask before mutating, not after: the create path panics on a failed dirlink.
|
||||
int fs_readonly(uint dev);
|
||||
int in_group(uint gid, int real);
|
||||
uint inode_mode_bits(struct inode *ip);
|
||||
int inode_permission(struct inode *ip, int mask, int real);
|
||||
int capable(void);
|
||||
int mount_add(uint dev, uint64 inum, uint fsdev, uint64 root,
|
||||
const char *path, const char *source, const char *type);
|
||||
// Walk the mount table for /proc/mounts. `path` and `source` need MAXPATH
|
||||
|
|
@ -601,6 +605,8 @@ int fork(void);
|
|||
int growproc(int64);
|
||||
int kill(int);
|
||||
int sigsend_pgrp(int pgid, int sig);
|
||||
int sigsend_user(int pid, int sig);
|
||||
int sigsend_pgrp_user(int pgid, int sig);
|
||||
int proc_pgid(int pid);
|
||||
int proc_setpgid(int pid, int pgid);
|
||||
int proc_setsid(void);
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ struct procinfo {
|
|||
int nthreads; // threads in that process
|
||||
};
|
||||
|
||||
#define NGROUPS_MAX 32
|
||||
|
||||
struct proc {
|
||||
uint64 sz; // Size of process memory (bytes) [+0x00]
|
||||
pml4e_t* pgdir; // Page table (PML4 on x86_64) [+0x08]
|
||||
|
|
@ -335,6 +337,10 @@ struct proc {
|
|||
// are tracked honestly so getuid()/setuid() stop lying to userland.
|
||||
uint uid, euid, suid;
|
||||
uint gid, egid, sgid;
|
||||
// Supplementary groups, as setgroups(2) set them: a file's group is
|
||||
// consulted against these as well as against egid.
|
||||
int ngroups;
|
||||
uint groups[NGROUPS_MAX];
|
||||
|
||||
// --- Fair-share scheduling --------------------------------------------
|
||||
// The whole of the scheduler's per-process state. What each field means,
|
||||
|
|
|
|||
|
|
@ -39,3 +39,4 @@ void pts_close(struct inode*);
|
|||
|
||||
// From kernel/fs/devfs.c: the inode of master N.
|
||||
struct inode *devfs_pty_master(int n);
|
||||
void devfs_pty_claim(int n, uint uid);
|
||||
|
|
|
|||
|
|
@ -134,6 +134,9 @@ struct inode {
|
|||
// that does not, in which case stat makes some up from the type. Bit 18 set
|
||||
// alone means a mode of 0000, which chmod can ask for.
|
||||
uint mode;
|
||||
// Owner. Whatever the filesystem keeps: SchFS has stored them all along,
|
||||
// FAT and the synthetic filesystems report root.
|
||||
uint uid, gid;
|
||||
uint supermode;
|
||||
uint showmode;
|
||||
uint atime;
|
||||
|
|
|
|||
Loading…
Reference in a new issue