Commit Graph

574 Commits

Author SHA1 Message Date
Enrico Fraccaroli (Galfurian) 21728285a6 Reactivate test_write_read function. 2024-03-01 14:28:00 -05:00
Enrico Fraccaroli 636f8c68c5 Merge pull request #41 from fischerling/fix-permissions
Fix and rework our permission permissions
2024-03-01 14:26:43 -05:00
Enrico Fraccaroli (Galfurian) 50569ed1c8 Fix cat to handle symlinks correctly. 2024-03-01 13:51:06 -05:00
Enrico Fraccaroli (Galfurian) 81ca704adb Check for symbolic links in more function. 2024-03-01 13:45:29 -05:00
Enrico Fraccaroli a4091ca57b Merge pull request #40 from fischerling/add-pager
add simple `more(1)` implementation and use it for man pages
2024-03-01 13:32:27 -05:00
Enrico Fraccaroli (Galfurian) 57bd59bb43 Fix proper error checking with readlink in cat. 2024-03-01 13:21:21 -05:00
Florian Fischer f687b89c74 ext2: check directory permissions during resolving of paths 2024-03-01 18:29:25 +01:00
Florian Fischer 0347054fae fs: move and fix generic permission checks
As defined by POSIX permissions are checked for the first matching class,
user, group or others.
Only the permissions of this first matching class are considered.

For example:
Consider a process running for user and group.
A file with user:group -w- rw- --- is not readable by user, and
thus not readable by the process.
However, it is readable by anyone else in the group.

Additionally, since the permission checks are generic and not exclusive
to the ext2 driver, they are moved to the vfs code.
2024-03-01 17:55:58 +01:00
Enrico Fraccaroli 2df2f34f22 Merge pull request #39 from fischerling/fix-strlen
fix str[n]len implementations
2024-03-01 11:27:09 -05:00
Florian Fischer 9bb19e22be man: use more as pager for man 2024-03-01 17:22:04 +01:00
Florian Fischer 2644a07f66 add simple more implementation 2024-03-01 17:21:26 +01:00
Florian Fischer c8db92b7b7 fix str[n]len implementations
The current implementations do not count the length of empty strings
correctly.
The following buffer content "\0foo\0" is considered a string with
length 4, because the iteration pointer is incremented before
it is dereferenced to check for a null char.

Replace the broken strlen functions with the implementation of musl libc.
2024-03-01 17:13:39 +01:00
Enrico Fraccaroli (Galfurian) 082ea79648 Add newline at the end of fcvt. 2024-03-01 09:16:25 -05:00
Enrico Fraccaroli 272a246e29 Merge pull request #38 from fischerling/setattr
support setting file attributes
2024-03-01 09:14:46 -05:00
Enrico Fraccaroli (Galfurian) 67223d0edf Extend the write/read test. 2024-02-29 16:44:26 -05:00
Enrico Fraccaroli (Galfurian) e4e740c1c5 Add the ext2_clean_inode_content function to clear the content of an inode. Use it to implement the O_TRUNC. 2024-02-29 16:44:11 -05:00
Enrico Fraccaroli (Galfurian) d213be2bcf Add the bitmask_exact. 2024-02-29 16:43:33 -05:00
Florian Fischer 2ab2dd8a11 add manual pages for chown and chmod 2024-02-29 22:04:09 +01:00
Florian Fischer f4f57e0750 ext2: implement setattr support
This adds support for chown and chmod on etx2 filesystems.
2024-02-29 22:04:09 +01:00
Florian Fischer 548feeaf7d add simple chmod implementation 2024-02-29 22:04:09 +01:00
Florian Fischer 761abc0172 add simple chown program 2024-02-29 22:04:09 +01:00
Florian Fischer 61024ac3f3 add *chmod, and *chown syscalls 2024-02-29 21:49:01 +01:00
Florian Fischer 9ee6421e1b fs: add callbacks to change file attributes 2024-02-29 21:49:01 +01:00
Enrico Fraccaroli (Galfurian) 79a9897a61 Extend the test to include checks on truncate. 2024-02-29 14:28:22 -05:00
Enrico Fraccaroli (Galfurian) 0b1bc2844b Fix wrong check in sys_write. 2024-02-29 14:27:55 -05:00
Enrico Fraccaroli f538920b24 Merge pull request #36 from fischerling/implement-id-separation
Implement user and group ID separation
2024-02-29 13:58:04 -05:00
Enrico Fraccaroli (Galfurian) 152f141d5a Remove const from ata devices. 2024-02-29 13:17:37 -05:00
Enrico Fraccaroli (Galfurian) 61824151fb Add more missing comments. 2024-02-29 13:14:38 -05:00
Enrico Fraccaroli (Galfurian) 9950584c12 Add comment to the __debug_print_header function. 2024-02-29 12:56:45 -05:00
Enrico Fraccaroli (Galfurian) 113e902a62 Add comments to the function vm_area_compare. 2024-02-29 12:56:14 -05:00
Enrico Fraccaroli (Galfurian) 91e1a116c7 Disable doxygen for fcvt.c file. 2024-02-29 12:51:04 -05:00
Enrico Fraccaroli (Galfurian) e67aced2c0 Add missing comments for pci_dump_device_data function. 2024-02-29 12:50:49 -05:00
Enrico Fraccaroli (Galfurian) 179a301c40 Merge branch 'develop' of github.com:mentos-team/MentOS into develop 2024-02-29 12:30:35 -05:00
Enrico Fraccaroli fb1a6fcf15 Merge pull request #35 from fischerling/restart-login
init: restart the login process after the user session terminated
2024-02-29 12:29:32 -05:00
Enrico Fraccaroli 9bb52a8494 Merge pull request #37 from fischerling/add-dev-null
drivers: implement memory device driver
2024-02-29 12:28:08 -05:00
Enrico Fraccaroli bd864fe384 Merge pull request #34 from fischerling/implement_dup
Implement dup syscall
2024-02-29 12:26:21 -05:00
Florian Fischer 3bf6119030 drivers: implement memory device driver
The first and only memory device mounted at /dev/null discards all data
written to it and always returns 0 bytes when read.
2024-02-29 17:59:24 +01:00
Florian Fischer dba41a3719 fix usage of pid_t instead of gid_t 2024-02-29 17:55:48 +01:00
Florian Fischer b149807ccc support and use the new uid syscalls from userspace 2024-02-29 17:55:48 +01:00
Florian Fischer 43c5bbaaff exec: support SUID and SGID bits 2024-02-29 17:55:48 +01:00
Florian Fischer 9f0d8eca0d implement effective and real user and group id separation
New syscalls:
  * geteuid
  * setreuid
  * getegid
  * setregid
2024-02-29 17:55:48 +01:00
Florian Fischer 9de28df51a stddef: make uid_t and gid_t signed
POSIX describes uid_t and gid_t as SIGNED integer types.
They need to be able to store -1 for various syscalls.
2024-02-29 17:55:47 +01:00
Florian Fischer 58ceead501 add simple id implementation 2024-02-29 17:55:47 +01:00
Florian Fischer 1a6a590eee init: restart the login process after the user session terminated 2024-02-29 17:47:00 +01:00
Florian Fischer cf8781398d use get_unused_fd helper to find the lowest available fd 2024-02-29 17:43:28 +01:00
Florian Fischer 2d8350f732 implement dup syscall 2024-02-29 17:43:20 +01:00
Enrico Fraccaroli (Galfurian) b79f768a0f Use the ptr_to_malloc_header function. 2024-02-29 11:18:03 -05:00
Enrico Fraccaroli (Galfurian) 45229810be - Check for errors from the brk;
- Use the new malloc_header_to_ptr function in malloc;
2024-02-29 11:17:09 -05:00
Enrico Fraccaroli (Galfurian) 670320df13 malloc(0) is implementation-dependant, we return NULL. 2024-02-29 11:16:29 -05:00
Enrico Fraccaroli (Galfurian) f088eb4058 - Add comments to the malloc_header_t structure;
- Add functions that extract the memory pointer from a pointer to the header, and vice versa;
2024-02-29 11:15:25 -05:00