Commit graph

2770 commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen
c195784736 Fix sysmerge(8) out of bounds accesses and error messages. 2016-08-23 00:30:41 +02:00
Jonas 'Sortie' Termansen
f28fc4ac39 Fix non-blocking recv(2) and send(2). 2016-08-22 01:47:31 +02:00
Jonas 'Sortie' Termansen
8ec5d9af44 Fix linked list and shadowing bugs in kernel clock and timer code. 2016-08-21 00:04:27 +02:00
Jonas 'Sortie' Termansen
e962f5e4cc Fix use after free in getaddrinfo(3) error case. 2016-08-21 00:04:27 +02:00
Jonas 'Sortie' Termansen
46fbe3ec0d Fix non-relative path in sysupgrade(8). 2016-08-21 00:04:27 +02:00
Jonas 'Sortie' Termansen
47b53f1aab Fix missing word in sysupgrade(8) error message. 2016-08-21 00:04:26 +02:00
Jonas 'Sortie' Termansen
2b6463aa95 Fix drivers not detecting PCI devices without an interrupt line. 2016-08-21 00:03:58 +02:00
Jonas 'Sortie' Termansen
da89dec2e2 Fix AHCI port IDENTIFY timeout taking 10 seconds. 2016-08-21 00:03:57 +02:00
Jonas 'Sortie' Termansen
8f81f990f8 Fix undefined stack register after switch into long mode.
Thanks to dminuoso for pointing out the issue.
2016-07-29 15:20:05 +02:00
Jonas 'Sortie' Termansen
2141c95621 Fix sysupgrade(8) downgrade detection. 2016-07-29 15:20:05 +02:00
Jonas 'Sortie' Termansen
1dbd1f760a Fix missing validation of program entry points. 2016-07-29 15:20:04 +02:00
Jonas 'Sortie' Termansen
b54e09ebaf Improve cross-development(7). 2016-07-23 23:30:33 +02:00
Jonas 'Sortie' Termansen
92106d4d34 Remove unnecessary tix gitignore entry. 2016-07-23 22:13:39 +02:00
Jonas 'Sortie' Termansen
2e03bd94d3 Add protection against sigreturn oriented programming (SROP).
This change hardens against invalid calls to sigreturn, which is a very
useful gadget when compromising a process. The system call now verifies
it is a real return from a signal and aborts the process otherwise. This
should render such attacks impossible in threads that are not servicing a
signal, and infeasible in threads that are handling signals they are yet to
return from.

The kernel now keeps track for each thread how many signals are being
handled but haven't returned yet.

Each thread now has a random signal value. It is re-randomized when the
thread handles a signal and the current signal counter is zero. This is
xorred with the context address and used as canary on the stack during
signal dispatch, protecting the saved context on the stack. This works
mostly like the regular stack protector.

The kernel now keeps track of the stack pointer for a single handled
signal per thread. It doesn't seem worth it to keep track of multiple
handled signals, as more than one is rare. Note that each delivered signal
will not necessarily result in a sigreturn because it is valid for a thread
to longjmp(3) out of a signal handler to a valid jmp_buf.

The sigreturn system call will abort if either:

- It was not called from the kernel sigreturn page.
- The thread is not currently processing a signal.
- The thread is processing a single signal, and the stack pointer did not
  have the expected value.
- It fails to read the context on the stack.
- The canary is wrong.
2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
9b98679885 Clean up errno. 2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
01a9779fc6 Compile libc with -ffreestanding.
This properly avoids problems where the compiler is unaware that this is the
implementation and assumes it can rely on the implementation. For instance,
it might implement calloc using a call to calloc.

Restructure the code that wrongly assumed __STDC_HOSTED__ meant userspace.
2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
1ca1a068a1 Make the branding system more neutral. 2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
264805a4aa Remove uname -i and -o options.
These are unportable GNU extensions that's not needed for Sortix.
2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
e4a3bb997b Check overflow in expr(1). 2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
2a6a246ff4 Remove getdomainname(2). 2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
1ef3c31f81 Clean up alloca.h header. 2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
e5ed21520c Port the editor to non-sortix operating systems. 2016-05-15 22:43:29 +02:00
Jonas 'Sortie' Termansen
63146072a4 Fix getline(3) and getdelim(3) usage. 2016-05-15 19:32:04 +02:00
Jonas 'Sortie' Termansen
8d5599ba59 Fix shift out of bounds in fnmatch(3). 2016-05-15 19:30:51 +02:00
Jonas 'Sortie' Termansen
1fde4430fb Fix missing punctuation in hier(7). 2016-05-15 19:30:51 +02:00
Jonas 'Sortie' Termansen
f6cc06fbd1 Fix bsearch(3) performance. 2016-05-15 19:30:51 +02:00
Jonas 'Sortie' Termansen
1826fc32cd Fix signal delivery stack alignment. 2016-05-15 19:30:51 +02:00
Jonas 'Sortie' Termansen
d9bb6da811 Fix pthread stack alignment. 2016-05-15 19:30:51 +02:00
Jonas 'Sortie' Termansen
a80bc5d011 Fix sysmerge(8) and sysupgrade(8) /etc/sortix-release error handling. 2016-05-15 01:31:48 +02:00
Jonas 'Sortie' Termansen
9995df3638 Fix use after free and memory leaks in init(8).
Thanks to Tiago Silva and Shiz for noticing these issues.
2016-05-15 01:31:48 +02:00
Jonas 'Sortie' Termansen
e69565fd15 Remove compatibility with Sortix 0.9. 2016-05-15 01:31:48 +02:00
Jonas 'Sortie' Termansen
f3d77725d2 Begin development of Sortix 1.1. 2016-04-04 02:36:03 +02:00
Jonas 'Sortie' Termansen
578501924c Update version number to 1.0. 2016-03-28 18:38:40 +02:00
Jonas 'Sortie' Termansen
09f43c80e9 Change /mnt to / in sysinstall to avoid user confusion. 2016-03-28 17:46:51 +02:00
Jonas 'Sortie' Termansen
ecfe121a8c Add assertions to Signal::DispatchHandler callers. 2016-03-28 17:37:37 +02:00
Jonas 'Sortie' Termansen
c1e5bcba7f Fix S_IROTH having the wrong value. 2016-03-28 16:25:42 +02:00
Jonas 'Sortie' Termansen
8e34889cbd Fix disked verify_mountpoint buffer overflow. 2016-03-28 14:31:23 +02:00
Jonas 'Sortie' Termansen
bc2f6842d1 Add -type option to find(1). 2016-03-27 14:51:44 +02:00
Jonas 'Sortie' Termansen
927ed5e01f Use video_bochs with Sortix GRUB. 2016-03-27 13:55:51 +02:00
Jonas 'Sortie' Termansen
fe87b61a33 Add tagline. 2016-03-26 23:50:50 +01:00
Jonas 'Sortie' Termansen
d166e58dc8 Remove repository from release directory. 2016-03-26 23:50:50 +01:00
Jonas 'Sortie' Termansen
9a95771cd9 Change default OPTLEVEL to -Os -s. 2016-03-26 23:50:50 +01:00
Jonas 'Sortie' Termansen
03304642df Add GRUB menus to control which ports are loaded. 2016-03-26 23:50:50 +01:00
Jonas 'Sortie' Termansen
9f77beaea6 Fix floating point registers of new threads. 2016-03-26 23:29:09 +01:00
Jonas 'Sortie' Termansen
e770766cc8 Fix tix archive owner, group and permissions.
tix-build recorded the owner and group as the user building the package,
rather than setting the owner and group to user 0 (root).

tix-install tried to chown extracted files as the owner and group in the
archive, rather than the current user. It also applied the current umask
rather than restoring the same permissions.
2016-03-26 23:29:08 +01:00
Jonas 'Sortie' Termansen
05282c86d7 Fix fchownat(2) system call ABI on x86.
This system call has five arguments, of which one is a 64-bit uid_t, and
another is a 64-bit gid_t, which means that 7 registers are needed. However,
x86 only has 5 registers available for system calls. Wrap the system call
with a structure like with mmap(2).
2016-03-26 23:28:36 +01:00
Jonas 'Sortie' Termansen
1083e67d45 Fix sysinstall videomode creation. 2016-03-26 16:07:22 +01:00
Jonas 'Sortie' Termansen
9ec09476ba Fix handling of unmountable filesystems. 2016-03-26 16:07:22 +01:00
Jonas 'Sortie' Termansen
34b5f061f9 Fix linecount target not working. 2016-03-26 16:07:22 +01:00
Jonas 'Sortie' Termansen
7348cb0b9a Add initrd module options. 2016-03-07 18:37:20 +01:00