Andreas Kling
faf32153f6
Kernel: Take const Process& in InodeMetadata::may_{read,write,execute}
2020-01-07 19:24:06 +01:00
DAlperin
dcc4704fb5
LibGUI: Preserve existing GItemView selection on rubber band ( #1031 )
2020-01-07 16:18:12 +01:00
Andreas Kling
5387a19268
Kernel: Make Process::file_description() vend a RefPtr<FileDescription>
...
This encourages callers to strongly reference file descriptions while
working with them.
This fixes a use-after-free issue where one thread would close() an
open fd while another thread was blocked on it becoming readable.
Test: Kernel/uaf-close-while-blocked-in-read.cpp
2020-01-07 15:53:42 +01:00
Andreas Kling
a47f3031ae
LibC: Add MAP_FILE for mmap()
2020-01-07 15:35:41 +01:00
Andreas Kling
a49d9c774f
TmpFS: Add ASSERT(offset >= 0) to read_bytes() and write_bytes()
2020-01-07 15:25:56 +01:00
Andreas Kling
c48acafcba
AK: Add assertions to FixedArray::operator[]
...
Let's catch ourselves if we ever index out of bounds into one of these.
2020-01-07 14:49:33 +01:00
Andreas Kling
6a4b376021
Kernel: Validate ftruncate(fd, length) syscall inputs
...
- EINVAL if 'length' is negative
- EBADF if 'fd' is not open for writing
2020-01-07 14:48:43 +01:00
Andreas Kling
bb9db9d430
TmpFS: Add "." and ".." entries to all directories
...
It was so weird not seeing them in "ls -la" output :^)
2020-01-07 14:48:43 +01:00
Conrad Pankoff
0e7cee58c0
LibGUI: Run clang-format on GModel.h to neaten up some formatting
2020-01-07 12:46:22 +01:00
Conrad Pankoff
84f0be37f0
LibCore: Fix a typo in CConfigFile.h
2020-01-07 12:46:02 +01:00
Conrad Pankoff
c7fd39f3b1
AK: Add dirname() to FileSystemPath
2020-01-07 12:36:30 +01:00
Andreas Kling
3f3169c225
FileManager: Unbreak build after "select all" changes
2020-01-07 11:12:33 +01:00
Shannon Booth
6192467de9
Filemanager: Add Ctrl+A select all action
...
Unfortunately this means that current_view() needed to be made non-const
as changing the selection is a non-const operation.
2020-01-07 11:06:27 +01:00
Shannon Booth
7cf15bcb75
GAbstractView: Add function for adding all to selection
2020-01-07 11:06:27 +01:00
N00byEdge
00596296c4
LibDraw: Add support for parsing #RGBA colors
...
This was the nicest way of making this happen, I think.
Fitting it into the 4 length function ended up becoming too hard to read.
Closes #1027
2020-01-07 11:03:35 +01:00
0xtechnobabble
123dcada05
Themes: Support rubberband selection theming
2020-01-07 11:02:43 +01:00
Andreas Kling
56a2c21e0c
Kernel: Don't leak kmalloc pointers through FIFO absolute paths
...
Instead of using the FIFO's memory address as part of its absolute path
identity, just use an incrementing FIFO index instead.
Note that this is not used for anything other than debugging (it helps
you identify which file descriptors refer to the same FIFO by looking
at /proc/PID/fds
2020-01-07 10:29:47 +01:00
Andreas Kling
5646a95161
Kernel: Make Socket::absolute_path() pure virtual
...
This is overridden by all subclasses, so can just be pure virtual.
2020-01-07 10:24:45 +01:00
Andreas Kling
78a63930cc
Kernel+LibELF: Validate PT_LOAD and PT_TLS offsets before memcpy()'ing
...
Before this, you could make the kernel copy memory from anywhere by
setting up an ELF executable with a program header specifying file
offsets outside the file.
Since ELFImage didn't even know how large it was, we had no clue that
we were copying things from outside the ELF.
Fix this by adding a size field to ELFImage and validating program
header ranges before memcpy()'ing to them.
The ELF code is definitely going to need more validation and checking.
2020-01-06 21:04:57 +01:00
Andreas Kling
9bf1fe9439
LibC: Remove thread-specific TID cache
...
As Sergey pointed out forever ago, this value is wrong after fork().
2020-01-06 14:39:52 +01:00
Andreas Kling
8088fa0556
Kernel: Process::send_signal() should prefer main thread
...
The main/first thread in a process always has the same TID as the PID.
2020-01-06 14:37:26 +01:00
Andreas Kling
a803312eb4
Kernel: Send SIGCHLD to the thread with same PID as my PPID
...
Instead of delivering SIGCHLD to "any thread" in the process with PPID,
send it to the thread with the same TID as my PPID.
2020-01-06 14:35:42 +01:00
Andreas Kling
cd42ccd686
Kernel: The waitpid() syscall was not storing to "wstatus" in all cases
2020-01-06 14:34:04 +01:00
Andreas Kling
0e6ea49410
Kernel: Fix SMAP violation when doing a crash dump
2020-01-06 14:26:47 +01:00
Andreas Kling
8e7420ddf2
Kernel: Harden memory mapping of the kernel image
...
We now map the kernel's text and rodata segments read+execute.
We also make the data and bss segments non-executable.
Thanks to q3k for the idea! :^)
2020-01-06 13:55:39 +01:00
Andreas Kling
47cc3e68c6
Kernel: Remove bogus kernel image access validation checks
...
This code had been misinterpreting the Multiboot ELF section headers
since the beginning. Furthermore QEMU wasn't even passing us any
headers at all, so this wasn't checking anything.
2020-01-06 13:27:14 +01:00
Andreas Kling
99f71a9a2c
Kernel: Randomize the stack canary on startup
2020-01-06 13:05:40 +01:00
Andreas Kling
0614c3dd3c
Kernel: Build the kernel as a position-independent executable
...
This is a prerequisite for KASLR, which we should eventually be doing.
2020-01-06 13:04:11 +01:00
Andreas Kling
53bda09d15
Kernel: Make utime() take path+length, remove SmapDisabler
2020-01-06 12:23:30 +01:00
Andreas Kling
1226fec19e
Kernel: Remove SmapDisablers in stat() and lstat()
2020-01-06 12:13:48 +01:00
Andreas Kling
08cfcb888c
Kernel: Add KResult::error() to make it look symmetrical with KResultOr
2020-01-06 12:08:27 +01:00
Andreas Kling
a47f0c93de
Kernel: Pass name+length to mmap() and remove SmapDisabler
2020-01-06 12:04:55 +01:00
Andreas Kling
33025a8049
Kernel: Pass name+length to set_mmap_name() and remove SmapDisabler
2020-01-06 11:56:59 +01:00
Andreas Kling
6af8392cf8
Kernel: Remove SmapDisabler in futex()
2020-01-06 11:44:15 +01:00
Andreas Kling
a30fb5c5c1
Kernel: SMAP fixes for module_load() and module_unload()
...
Remove SmapDisabler in module_load() + use get_syscall_path_argument().
Also fix a SMAP violation in module_unload().
2020-01-06 11:36:16 +01:00
Andreas Kling
7c916b9fe9
Kernel: Make realpath() take path+length, get rid of SmapDisabler
2020-01-06 11:32:25 +01:00
Andreas Kling
d6b06fd5a3
Kernel: Make watch_file() syscall take path length as a size_t
...
We don't care to handle negative path lengths anyway.
2020-01-06 11:15:49 +01:00
Andreas Kling
cf7df95ffe
Kernel: Use get_syscall_path_argument() for syscalls that take paths
2020-01-06 11:15:49 +01:00
Andreas Kling
0df72d4712
Kernel: Pass path+length to mkdir(), rmdir() and chmod()
2020-01-06 11:15:49 +01:00
Andreas Kling
53d3b6b0a7
LibC: Make the syscall wrappers for stat/lstat/chdir return EFAULT
...
If we pass a null path to these syscall wrappers, just return EFAULT
directly from the wrapper instead of segfaulting by calling strlen().
This is a compromise, since we now have to pass the path length to the
kernel, so we can't rely on the kernel to tell us that the path is at
a bad memory address.
2020-01-06 11:15:49 +01:00
Andreas Kling
642137f014
Kernel: Make access() take path+length
...
Also, let's return EFAULT for nullptr at the LibC layer. We can't do
all bad addresses this way, but we can at least do null. :^)
2020-01-06 11:15:48 +01:00
Shannon Booth
ad4284428a
Meta: Allow sync.sh to be run from any directory
...
I often keep my terminal camped in the project root directory and run
`make && ./Kernel/sync.sh && ./Kernel/run`
This change allows me to not feel like a doofus when I do that :^)
2020-01-06 10:43:00 +01:00
Shannon Booth
47276a09dd
LibC: Remove dubious String ends_with usage
...
As mentioned in #917 , the String destructor could potentially be
clobbering the errno. Use memcpy so that we do not need String at all.
2020-01-06 10:43:00 +01:00
Shannon Booth
4a6605bbe5
AK: Fix test compile warnings
...
These warnings are pretty harmless, but warnings nonetheless.
2020-01-06 10:43:00 +01:00
Shannon Booth
d4fa8e4b00
AK+Demos+Libraries: Remove executable permissions from {.cpp,.h} files
2020-01-06 10:43:00 +01:00
Andreas Kling
2c3a6c37ac
Kernel: Paper over SMAP violations in clock_{gettime,nanosleep}()
...
Just put some SmapDisablers here to unbreak the nesalizer port.
2020-01-05 23:20:33 +01:00
Andreas Kling
c5890afc8b
Kernel: Make chdir() take path+length
2020-01-05 22:06:25 +01:00
Andreas Kling
f231e9ea76
Kernel: Pass path+length to the stat() and lstat() syscalls
...
It's not pleasant having to deal with null-terminated strings as input
to syscalls, so let's get rid of them one by one.
2020-01-05 22:02:54 +01:00
Andreas Kling
152a83fac5
Kernel: Remove SmapDisabler in watch_file()
2020-01-05 21:55:20 +01:00
Andreas Kling
80cbb72f2f
Kernel: Remove SmapDisablers in open(), openat() and set_thread_name()
...
This patch introduces a helpful copy_string_from_user() function
that takes a bounded null-terminated string from userspace memory
and copies it into a String object.
2020-01-05 21:51:06 +01:00