ladybird/Kernel/Syscalls
Rodrigo Tobar bf4e536f00 Kernel: Correctly interpret ioctl's FIONBIO user value
Values in `ioctl` are given through a pointer, but ioctl's FIONBIO
implementation was interpreting this pointer as an integer directly.
This meant that programs using `ioctl` to set a file descriptor in
blocking mode met with incorrect behavior: they passed a non-null
pointer pointing to a value of 0, but the kernel interpreted the pointer
as a non-zero integer, thus making the file non-blocking.

This commit fixes this behavior by reading the value from the userspace
pointer and using that to set the non-blocking flag on the file
descriptor.

This bug was found while trying to run the openssl tool on serenity,
which used `ioctl` to ensure newly-created sockets are in blocking mode.
2021-10-11 10:46:01 -07:00
..
access.cpp Kernel: Use TRY() in sys$access() 2021-09-05 16:25:40 +02:00
alarm.cpp Kernel: Use TRY() in sys$alarm() 2021-09-06 13:06:05 +02:00
anon_create.cpp Kernel: Rename FileDescription => OpenFileDescription 2021-09-07 13:53:14 +02:00
beep.cpp Kernel: Disable big process lock for sys$beep() 2021-08-06 23:36:12 +02:00
chdir.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
chmod.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
chown.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
clock.cpp Kernel: Make copy_time_from_user() helpers use KResultOr<Time> 2021-09-07 01:18:02 +02:00
debug.cpp Kernel: Use TRY() in sys$dbgputstr() 2021-09-05 18:15:05 +02:00
disown.cpp Kernel/Process: Move protected values to the end of the object 2021-08-12 20:57:32 +02:00
dup2.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
emuctl.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
execve.cpp Kernel: Only instantiate main_program_metadata in the scope it's needed 2021-09-16 17:17:13 +02:00
exit.cpp Kernel: Fix a few typos 2021-10-01 00:51:49 +01:00
fcntl.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
fork.cpp Kernel: Rename FileDescription => OpenFileDescription 2021-09-07 13:53:14 +02:00
fsync.cpp Kernel+LibC: Implement fsync 2021-09-12 11:24:02 +02:00
ftruncate.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
futex.cpp Kernel: Make copy_time_from_user() helpers use KResultOr<Time> 2021-09-07 01:18:02 +02:00
get_dir_entries.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
get_stack_bounds.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
getrandom.cpp Kernel: Use TRY() in sys$getrandom() 2021-09-06 02:36:21 +02:00
getuid.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
hostname.cpp Kernel: Use TRY() in sys$sethostname() 2021-09-05 18:22:18 +02:00
inode_watcher.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
ioctl.cpp Kernel: Correctly interpret ioctl's FIONBIO user value 2021-10-11 10:46:01 -07:00
keymap.cpp Kernel: Use TRY() in sys$setkeymap() 2021-09-05 18:15:05 +02:00
kill.cpp Kernel: Guard the all processes list with a Spinlock rather than a Mutex 2021-08-28 20:53:38 +02:00
link.cpp Kernel: Use copy_typed_from_user<T> for fetching syscall parameters 2021-09-05 17:51:37 +02:00
lseek.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
mkdir.cpp Kernel: Use TRY() in sys$mkdir() 2021-09-05 16:25:40 +02:00
mknod.cpp Kernel: Use copy_typed_from_user<T> for fetching syscall parameters 2021-09-05 17:51:37 +02:00
mmap.cpp Kernel: Allow PROT_NONE in mmap and mprotect for stack regions 2021-09-23 04:14:41 +00:00
mount.cpp Kernel: Rename DevFS => DevTmpFS 2021-09-08 00:42:20 +02:00
open.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
perf_event.cpp Kernel: Use TRY() in sys$perf_register_string() 2021-09-05 18:15:05 +02:00
pipe.cpp Kernel: Add support for O_NONBLOCK in pipe syscall 2021-09-19 12:20:16 +02:00
pledge.cpp Kernel: Use TRY() in sys$pledge() 2021-09-05 18:15:05 +02:00
prctl.cpp Kernel: Fix -Wunreachable-code warnings from clang 2021-10-08 23:33:46 +02:00
process.cpp Kernel: Store process names as KString 2021-09-07 13:53:14 +02:00
profiling.cpp Everywhere: Core dump => Coredump 2021-08-23 00:02:09 +02:00
ptrace.cpp Kernel: Rename ProcessPagingScope => ScopedAddressSpaceSwitcher 2021-09-06 18:56:51 +02:00
purge.cpp Kernel: Access MemoryManager static functions statically 2021-10-02 18:16:15 +02:00
read.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
readlink.cpp Kernel: Use TRY() in sys$readlink() 2021-09-05 17:55:43 +02:00
realpath.cpp Kernel: Improvements to Custody absolute path serialization 2021-09-06 13:06:05 +02:00
rename.cpp Kernel: Use TRY() in sys$rename() 2021-09-05 17:53:59 +02:00
rmdir.cpp Kernel: Use TRY() in sys$rmdir() 2021-09-05 17:54:33 +02:00
sched.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
select.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
sendfd.cpp Kernel: Use move semantics in sys$sendfd() 2021-09-15 21:09:47 +02:00
setpgid.cpp Kernel: Use KResultOr better in ProcessGroup construction 2021-09-06 01:55:27 +02:00
setuid.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
sigaction.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
socket.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
stat.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
statvfs.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
sync.cpp Kernel: Disable big process lock for sys$sync 2021-08-07 15:30:26 +02:00
sysconf.cpp Kernel: Add _SC_HOST_NAME_MAX 2021-09-11 00:28:39 +02:00
thread.cpp Kernel: Store process names as KString 2021-09-07 13:53:14 +02:00
times.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
ttyname.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00
umask.cpp Kernel/Process: Move protected values to the end of the object 2021-08-12 20:57:32 +02:00
uname.cpp Kernel: Make copy_{from,to}_user() return KResult and use TRY() 2021-09-05 17:38:37 +02:00
unlink.cpp Kernel: Use TRY() in sys$unlink() 2021-09-05 17:56:40 +02:00
unveil.cpp Kernel: Make KString factories return KResultOr + use TRY() everywhere 2021-09-06 19:25:36 +02:00
utime.cpp Kernel: Use TRY() in sys$utime() 2021-09-05 17:53:28 +02:00
waitid.cpp Kernel: Use AK::Variant default initialization where appropriate 2021-09-21 04:22:52 +04:30
write.cpp Kernel: Rename file_description(fd) => open_file_description(fd) 2021-09-07 13:53:14 +02:00