Kernel: Align argv and envp to pointer boundary
This bug was found with ubsan
This commit is contained in:
parent
fb7e9719a1
commit
41e1819072
|
@ -285,6 +285,9 @@ namespace Kernel
|
|||
// auxv
|
||||
needed_size += auxv.size() * sizeof(LibELF::AuxiliaryVector);
|
||||
|
||||
if (auto rem = needed_size % alignof(char*))
|
||||
needed_size += alignof(char*) - rem;
|
||||
|
||||
if (needed_size > m_userspace_stack->size())
|
||||
return BAN::Error::from_errno(ENOBUFS);
|
||||
|
||||
|
@ -358,8 +361,6 @@ namespace Kernel
|
|||
stack_push_str(envp[i]);
|
||||
}
|
||||
|
||||
ASSERT(vaddr == userspace_stack_top());
|
||||
|
||||
setup_exec(entry, userspace_stack_top() - needed_size);
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Reference in New Issue