1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Kernel: Fix String leaks in exec().

When the kernel performs a successful exec(), whatever was on the kernel
stack for that process before goes away. For this reason, we need to make
sure we don't have any stack objects holding onto kmalloc memory.
This commit is contained in:
Andreas Kling 2019-02-17 10:18:25 +01:00
parent 4b15dd2bca
commit cf8dd312ab
2 changed files with 22 additions and 19 deletions

View file

@ -279,7 +279,7 @@ public:
size_t amount_shared() const;
Process* fork(RegisterDump&);
int exec(const String& path, Vector<String>&& arguments, Vector<String>&& environment);
int exec(String path, Vector<String> arguments, Vector<String> environment);
bool is_root() const { return m_euid == 0; }
@ -302,7 +302,7 @@ private:
Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RetainPtr<Inode>&& cwd = nullptr, RetainPtr<Inode>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
int do_exec(const String& path, Vector<String>&& arguments, Vector<String>&& environment);
int do_exec(String path, Vector<String> arguments, Vector<String> environment);
void push_value_on_stack(dword);
int alloc_fd();