umh && creds: kill subprocess_info->cred logic
Subsystems (2)
PATCH 2/2 umh && creds: kill subprocess_info->cred logic
Now that nobody ever changes subprocess_info->cred we can kill this member and related code. ____call_usermodehelper() always runs in the context of freshly forked kernel thread, it has the proper ->cred copied from its parent kthread, keventd.
Signed-off-by Oleg Nesterov <[email protected]>
---
include/linux/cred.h | 1 include/linux/kmod.h | 1 kernel/cred.c | 54 --------------------------------------------------- kernel/kmod.c | 19 ----------------- 4 files changed, 75 deletions(-)
include/linux/cred.h renamed from include/linux/cred.h~2_KILL_INFO_CRED +0 -1
@@ -156,7 +156,6 @@ extern int copy_creds(struct task_structextern struct cred *cred_alloc_blank (void );extern struct cred *prepare_creds (void );extern struct cred *prepare_exec_creds (void ); -extern struct cred *prepare_usermodehelper_creds (void );extern int commit_creds (struct cred *);extern void abort_creds (struct cred *);extern const struct cred *override_creds (const struct cred *);
include/linux/kmod.h renamed from include/linux/kmod.h~2_KILL_INFO_CRED +0 -1
@@ -55,7 +55,6 @@ enum umh_wait {struct subprocess_info {struct work_struct work;struct completion *complete; -struct cred *cred;char *path;char **argv;char **envp;
kernel/cred.c renamed from kernel/cred.c~2_KILL_INFO_CRED +0 -54
60 lines not on this page · raw message
kernel/kmod.c renamed from kernel/kmod.c~2_KILL_INFO_CRED +0 -19
@@ -153,8 +153,6 @@ static int ____call_usermodehelper(voidstruct subprocess_info *sub_info = data;int retval; -BUG_ON (atomic_read (&sub_info->cred->usage) !=1 ); -/* Unblock all signals */ spin_lock_irq (¤t->sighand->siglock);flush_signal_handlers (current,1 );
@@ -162,10 +160,6 @@ static int ____call_usermodehelper(voidrecalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -/* Install the credentials */ -commit_creds (sub_info->cred); - sub_info->cred =NULL ; -/* We can run anywhere, unlike our parent keventd(). */ set_cpus_allowed_ptr (current, cpu_all_mask);
@@ -193,8 +187,6 @@ void call_usermodehelper_freeinfo(struct {if (info->cleanup) (*info->cleanup)(info); -if (info->cred) -put_cred (info->cred);kfree (info); }EXPORT_SYMBOL (call_usermodehelper_freeinfo);
@@ -250,8 +242,6 @@ static void __call_usermodehelper(structpid_t pid;enum umh_wait wait = sub_info->wait; -BUG_ON (atomic_read (&sub_info->cred->usage) !=1 ); -/* CLONE_VFORK: wait until the usermode helper has execve'd * successfully We need the data structures to stay around * until that is done. */
@@ -374,12 +364,6 @@ struct subprocess_info *call_usermodehel sub_info->path = path; sub_info->argv = argv; sub_info->envp = envp; - sub_info->cred =prepare_usermodehelper_creds (); -if (!sub_info->cred) { -kfree (sub_info); -return NULL ; - } - out:return sub_info; }
@@ -430,9 +414,6 @@ int call_usermodehelper_exec(struct subpDECLARE_COMPLETION_ONSTACK (done);int retval =0 ; -BUG_ON (atomic_read (&sub_info->cred->usage) !=1 ); -validate_creds (sub_info->cred); -helper_lock ();if (sub_info->path[0 ] =='\0' ) goto out;