Commit Graph

66 Commits

Author SHA1 Message Date
Ashwin Naren
253a907c62 fix tests 2026-01-27 00:31:47 -08:00
Ashwin Naren
04f015848b percpu refactor 2026-01-27 00:31:47 -08:00
Ashwin Naren
7c7776ba7b working top
implements enough of procfs for `top` to run
2026-01-27 00:31:47 -08:00
Matthew Leach
87fe041ba0 procfs: implement /proc/<PID>/maps
Implement the `maps` file which shows a process's VMA entries. Example
output:

```
[root@moss-machine /]# cat /proc/1/maps
500000000000-500000117000 r-xp 0000000000                    /bin/bash
50000012b000-500000130000 r--p 000011b000                    /bin/bash
500000130000-50000013e000 rw-p 0000120000                    /bin/bash
700000000000-70000002b000 r-xp 0000000000                    /lib/ld-linux-aarch64.so.1
70000003e000-700000040000 r--p 000002e000                    /lib/ld-linux-aarch64.so.1
700000040000-700000042000 rw-p 0000030000                    /lib/ld-linux-aarch64.so.1
7fffff510000-7fffff585000 r-xp 0000000000                    /usr/lib/libncursesw.so.6
7fffff585000-7fffff59b000 ---p 0000075000                    /usr/lib/libncursesw.so.6
7fffff59b000-7fffff5a0000 r--p 000007b000                    /usr/lib/libncursesw.so.6
7fffff5a0000-7fffff5a1000 rw-p 0000080000                    /usr/lib/libncursesw.so.6
7fffff5b0000-7fffff760000 r-xp 0000000000                    /usr/lib/libc.so.6
7fffff760000-7fffff76d000 ---p 00001b0000                    /usr/lib/libc.so.6
7fffff76d000-7fffff770000 r--p 00001bd000                    /usr/lib/libc.so.6
7fffff770000-7fffff772000 rw-p 00001c0000                    /usr/lib/libc.so.6
7fffff772000-7fffff779000 rw-p 0000000000
7fffff780000-7fffff7d9000 r-xp 0000000000                    /usr/lib/libreadline.so.8
7fffff7d9000-7fffff7ed000 ---p 0000059000                    /usr/lib/libreadline.so.8
7fffff7ed000-7fffff7f0000 r--p 000005d000                    /usr/lib/libreadline.so.8
7fffff7f0000-7fffff7f6000 rw-p 0000060000                    /usr/lib/libreadline.so.8
7fffff7f6000-7fffff7fb000 rw-p 0000000000
7fffff800000-800000063000 rw-p 0000000000                    [stack]
```
2026-01-27 06:10:43 +00:00
Ashwin Naren
2d34ebcef9 procfs refactor 2026-01-25 10:50:02 -08:00
Ashwin Naren
aa5a9c7b79 fix typos 2026-01-23 01:26:04 -08:00
Ashwin Naren
8df12a027c implement truncation 2026-01-18 01:17:19 -08:00
Matthew Leach
3ba7f668d6 libkernel: error: add Interrupted
Add the `Interrupted` discriminant for the `KernelError` enum. Also map
it to Linux's `EINTR` error value.
2026-01-17 10:21:17 +00:00
Matthew Leach
4bb3158812 Merge pull request #153 from arihant2math/prctl-updates
Implement more of prctl
2026-01-15 12:24:27 +00:00
Matthew Leach
2b55e1d972 sycalls: name_to_handle_at: stub
Return EOPNOTSUPP for `sys_name_to_handle_at`.
2026-01-14 14:24:35 -08:00
Ashwin Naren
3e60a57d67 implement xattr syscalls 2026-01-14 10:51:48 -08:00
Ashwin Naren
82993b05d3 implement PR_CAPBSET_DROP, PR_GET_SECUREBITS, PR_GET_NO_NEW_PRIVS, and PR_CAP_AMBIENT 2026-01-13 23:52:36 -08:00
Ashwin Naren
ff13b392f1 some support for ext4 writing 2026-01-13 16:47:51 -08:00
Ashwin Naren
cff5005c06 execute scripts
checks for shebang and executes the specified program
2026-01-12 14:23:49 -08:00
Matthew Leach
64bc004cdb process: sys_wait4: return ECHILD with no children
If the calling process has no children and no pending exit events to
handle, return ECHILD instead of waiting forever.
2026-01-11 19:23:47 -08:00
Ashwin Naren
15c70a1aea ext4 timestamps 2026-01-10 10:11:52 -08:00
Matthew Leach
bb8b3fec29 libkernel: ext4: add inode id to metadata
Add the proper inode and fs id to the `FileAttr` struct returned by
`getattr`. This prevents the dynamic loader from skipping files which it
considers to be hard-links (share the same inode ID).
2026-01-06 08:52:52 -08:00
Ashwin Naren
f0771dde4f exec with interpreter 2026-01-06 08:52:52 -08:00
Matthew Leach
957e3f04cf libkernel: waker_set: allow data to be associted
Allow data to be associated with a waker set. This allows discriminating
upon which wakes should be woken up via the new `wake_if` function.
2026-01-03 14:36:06 -08:00
Matthew Leach
d8bcc015de arch: arm64: detect kernel stack overflow condition
Currently, when a kernel stack overflow occures, the exception handler
blindly attempts to write the current context to the stack. If the SP
isn't valid this causes another fault, and so on - locking up the
system.

This commit re-arranges the stack layout, performs SP validation before
usage and switches to an emergency stack when SP isn't valid. This
allows the handler to run and panic gracefully.

Fixes: #98
2026-01-03 14:33:51 -08:00
Ashwin Naren
477215e641 optimize lookup 2026-01-02 17:01:02 -08:00
Ashwin Naren
8677d7a404 support readlink 2026-01-02 17:01:02 -08:00
Ashwin Naren
9d8379c311 fix readdir 2026-01-02 17:01:02 -08:00
Ashwin Naren
d14d2ff355 add note about lookup being suboptimal 2026-01-02 17:01:02 -08:00
Ashwin Naren
dcd74e4e73 optimize read_at 2026-01-02 17:01:02 -08:00
Ashwin Naren
b5138c30f9 working ext4 2026-01-02 17:01:02 -08:00
ootinnyoo
fe4f3103dc implement linux-like process capabilities 2025-12-29 13:53:02 -08:00
Ashwin Naren
74bc44a317 update dependencies 2025-12-29 12:03:32 -08:00
Matthew Leach
9c8571c2f7 per_cpu: make reentrant-safe
Disable interrupts on per_cpu guards, ensuring that critical-sections
are reentrant-safe.
2025-12-28 23:38:24 -08:00
ootinnyoo
caf1d923c8 implement sys_syncfs, sys_fsync, and sys_fdatasync 2025-12-28 15:55:12 -05:00
ootinnyoo
d2723b716c implement sys_statx 2025-12-28 10:41:15 -08:00
ootinnyoo
e31d1a05e8 move emptiness check to fs 2025-12-26 16:52:08 -08:00
ootinnyoo
aa29951c2d implement sys_renameat and sys_renameat2 2025-12-26 16:52:08 -08:00
ootinnyoo
70e81b39f4 add support for symlinks 2025-12-25 00:46:40 -08:00
someone
2a1bb1cdde implement hardlinking (#88) 2025-12-24 09:43:12 -08:00
Matthew Leach
efe34026fa Merge pull request #81 from arihant2math/mutex-timeouts 2025-12-24 08:08:20 +00:00
someone
3aef9a4e15 add chown/chmod (#84) 2025-12-23 15:19:25 -08:00
Ashwin Naren
c4f1d9acf5 support timeouts for futex 2025-12-23 13:08:37 -08:00
Matthew Leach
f7a02c6ccb libkernel: wakerset: add contains_token
Add a way to check whether the wakerset contains a token.
2025-12-23 10:21:30 -08:00
Matthew Leach
ca787aa4c3 libkernel: waker_set: return whether a waker was woken
Make `wake_one()` return `true` indicating whether a waker was woken
from the set, `false` otherwise.
2025-12-23 10:21:30 -08:00
ootinnyoo
8f00af7587 implement sys_fchdir 2025-12-22 18:34:22 -05:00
Ashwin Naren
3fbb56098c futex impl
# Conflicts:
#	usertest/src/main.rs
2025-12-21 01:43:54 -08:00
Ashwin Naren
cd6d830ae9 Initial proc fs (#70) 2025-12-21 01:37:14 -08:00
Ashwin Naren
35a6caa541 Implement sys_sysinfo (#71) 2025-12-20 15:42:08 -08:00
Ashwin Naren
781b9b5c3f implement mkdir and unlink
rm, mkdir and rmdir now work in tmpfs
2025-12-18 15:35:09 +00:00
Matthew Leach
9db6162414 formatting 2025-12-17 20:04:31 -08:00
Matthew Leach
8bc271c266 fs: open: pass create mode parameter
Pass the `mode` parameter to the open VFS call, specifying the
permissions of the file when O_CREAT is specified.
2025-12-17 20:04:31 -08:00
Matthew Leach
bebee6d8f5 libkernel: address: ensure to_pfn can only be called on PA
calculating a PFN from a VA makes no sense since it could be mapped to
any address. Therefore, ensure that it can *only* be called on PAs.
2025-12-17 20:04:31 -08:00
Matthew Leach
a867493fa7 page_alloc: make test fixture public
Having the ability to use the `FrameAlloctor`, simulating via the heap
is a very useful pattern when testing libkernel code. Make the test
fixture public for other modules to use.
2025-12-17 20:04:31 -08:00
Matthew Leach
54f2d683b8 libkernel: move ClaimedPage into libkernel crate
By moving `ClaimedPage` into libkernel we can utilise it in
arch-agonstic ode.
2025-12-17 20:04:31 -08:00