summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-13 23:14:30 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-13 23:14:30 +0100
commit032d9d706521c2b0dc1003364b5fc2cf6316bf4f (patch)
treef2b22a288f758b68fdc9d34fc6db9584051d469d /Kernel/Process.cpp
parent7aba68d51c5bbbe8ef3de914b26c2d388ee3cf57 (diff)
downloadserenity-032d9d706521c2b0dc1003364b5fc2cf6316bf4f.zip
IPv4: More hacking on bringing up TCP support.
This was a bit more complicated than I expected, but it's moving forward.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index c749d06c98..2a5883ebdc 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1073,6 +1073,7 @@ void Process::crash()
{
ASSERT_INTERRUPTS_DISABLED();
ASSERT(state() != Dead);
+
m_termination_signal = SIGSEGV;
dump_regions();
ASSERT(is_ring3());
@@ -2533,7 +2534,7 @@ ssize_t Process::sys$sendto(const Syscall::SC_sendto_params* params)
if (!validate_read(data, data_length))
return -EFAULT;
- if (!validate_read(addr, addr_length))
+ if (addr && !validate_read(addr, addr_length))
return -EFAULT;
auto* descriptor = file_descriptor(sockfd);
if (!descriptor)
@@ -2559,17 +2560,21 @@ ssize_t Process::sys$recvfrom(const Syscall::SC_recvfrom_params* params)
if (!validate_write(buffer, buffer_length))
return -EFAULT;
- if (!validate_read_typed(addr_length))
- return -EFAULT;
- if (!validate_read(addr, *addr_length))
- return -EFAULT;
+ if (addr_length) {
+ if (!validate_read_typed(addr_length))
+ return -EFAULT;
+ if (!validate_read(addr, *addr_length))
+ return -EFAULT;
+ } else if (addr) {
+ return -EINVAL;
+ }
auto* descriptor = file_descriptor(sockfd);
if (!descriptor)
return -EBADF;
if (!descriptor->is_socket())
return -ENOTSOCK;
auto& socket = *descriptor->socket();
- kprintf("recvfrom %p (%u), flags=%u, addr: %p (%u)\n", buffer, buffer_length, flags, addr, *addr_length);
+ kprintf("recvfrom %p (%u), flags=%u, addr: %p (%p)\n", buffer, buffer_length, flags, addr, addr_length);
return socket.recvfrom(buffer, buffer_length, flags, addr, addr_length);
}