call_usermodehelper: call info->init() after set_user_nice()
Quoted 4 lines · Oleg Nesterov
Mostly cosmetic, but imho it makes sense to call
sub_info->init()right beforekernel_execve(). This looks more natural and allows ->init() hook to change the priority if needed.
Forgot t mention...
This is on top of "umh && creds" patches I sent.
And this is the last change I was going to do ;)
Oleg.
PATCH 1/1 call_usermodehelper: call info->init() after set_user_nice()
Mostly cosmetic, but imho it makes sense to call sub_info->init() right before kernel_execve(). This looks more natural and allows ->init() hook to change the priority if needed.
---
kernel/kmod.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
kernel/kmod.c renamed from kernel/kmod.c~5_MOVE_INIT_DOWN +5 -7
@@ -159,6 +159,11 @@ static int ____call_usermodehelper(void/* We can run anywhere, unlike our parent keventd(). */ set_cpus_allowed_ptr (current, cpu_all_mask); +/* +* Our parent is keventd, which runs with elevated scheduling priority. +* Avoid propagating that into the userspace child. +*/ +set_user_nice (current,0 );if (sub_info->init) { retval = sub_info->init (sub_info);
@@ -166,14 +171,7 @@ static int ____call_usermodehelper(void goto fail; } -/* -* Our parent is keventd, which runs with elevated scheduling priority. -* Avoid propagating that into the userspace child. -*/ -set_user_nice (current,0 ); - retval =kernel_execve (sub_info->path, sub_info->argv, sub_info->envp); -/* Exec failed? */ fail: sub_info->retval = retval;
Quoted 32 lines · Oleg Nesterov
Mostly cosmetic, but imho it makes sense to call
sub_info->init()right beforekernel_execve(). This looks more natural and allows ->init() hook to change the priority if needed.Signed-off-by Oleg Nesterov <[email protected]>---
kernel/kmod.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)kernel/kmod.c renamed from kernel/kmod.c~5_MOVE_INIT_DOWN +5
-1@@ -159,6 +159,11 @@ static int ____call_usermodehelper(void/* We can run anywhere, unlike our parent keventd(). */ set_cpus_allowed_ptr (current, cpu_all_mask); +/* +* Our parent is keventd, which runs with elevated scheduling priority. +* Avoid propagating that into the userspace child. +*/ +set_user_nice (current,0 );if (sub_info->init) { retval = sub_info->init (sub_info);@@ -166,14 +171,7 @@ static int ____call_usermodehelper(void goto fail; } -/*
kernel/kmod.c static int ____call_usermodehelper(void · line 177
Quoted 10 lines
kernel/kmod.c renamed from kernel/kmod.c~5_MOVE_INIT_DOWN +0
-6-* Our parent is keventd, which runs with elevated scheduling priority. -* Avoid propagating that into the userspace child. -*/ -set_user_nice (current,0 ); - retval =kernel_execve (sub_info->path, sub_info->argv, sub_info->envp); -/* Exec failed? */ fail: sub_info->retval = retval;
Sure, why not. :)