From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Andrew Morton <akpm@osdl.org>
Cc: Bj?rn Steinbrink <B.Steinbrink@gmx.de>,
rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Return real errno from execve in ____call_usermodehelper
Date: Sat, 19 Aug 2006 09:42:33 +0100 [thread overview]
Message-ID: <20060819084233.GA25767@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060819011428.05ec2ae4.akpm@osdl.org>
On Sat, Aug 19, 2006 at 01:14:28AM -0700, Andrew Morton wrote:
> On Sat, 19 Aug 2006 09:30:31 +0200
> Bj?rn Steinbrink <B.Steinbrink@gmx.de> wrote:
>
> > If execve fails in ____call_usermodehelper we treat its return value as
> > error code, but as execve is a syscall, we actually want -errno there.
> >
> > Signed-off-by: Bj?rn Steinbrink <B.Steinbrink@gmx.de>
> >
> > --
> >
> > diff --git a/kernel/kmod.c b/kernel/kmod.c
> > index 1d32def..865abc0 100644
> > --- a/kernel/kmod.c
> > +++ b/kernel/kmod.c
> > @@ -149,8 +149,10 @@ static int ____call_usermodehelper(void
> > set_cpus_allowed(current, CPU_MASK_ALL);
> >
> > retval = -EPERM;
> > - if (current->fs->root)
> > - retval = execve(sub_info->path, sub_info->argv,sub_info->envp);
> > + if (current->fs->root) {
> > + execve(sub_info->path, sub_info->argv, sub_info->envp);
> > + retval = -errno;
> > + }
> >
> > /* Exec failed? */
> > sub_info->retval = retval;
>
> ug. I wish we could find some way of using do_execve() here. Or hoist
> sys_execve() out of the architectures.
Some architectures do implement their own special execve() function,
some of which are written for how this code above currently is (iow,
not using errno) and are probably buggy in that respect.
Maybe what we should be thinking of doing is changing execve() calls
to kernel_execve() which returns the error code.
This way, architectures are free to implement execve() whatever way
they wish - and if they're concerned about using errno, that's their
own implementation specific detail.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2006-08-19 8:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-19 7:30 [PATCH] Return real errno from execve in ____call_usermodehelper Björn Steinbrink
2006-08-19 8:14 ` Andrew Morton
2006-08-19 8:42 ` Russell King [this message]
2006-08-20 13:01 ` Arnd Bergmann
2006-08-20 13:47 ` Björn Steinbrink
2006-08-20 17:13 ` [PATCH] introduce kernel_execve function to replace __KERNEL_SYSCALLS__ Arnd Bergmann
2006-08-20 17:36 ` Chase Venters
2006-08-20 18:25 ` Andrew Morton
2006-08-20 18:32 ` Chase Venters
2006-08-20 19:45 ` Björn Steinbrink
2006-08-20 19:50 ` Arjan van de Ven
2006-08-20 20:11 ` Björn Steinbrink
2006-08-20 20:20 ` Arjan van de Ven
2006-08-20 20:36 ` Björn Steinbrink
2006-08-20 20:40 ` Arjan van de Ven
2006-08-21 1:55 ` Jeff Dike
2006-08-20 20:33 ` Arnd Bergmann
2006-08-20 19:31 ` Arnd Bergmann
2006-08-21 0:36 ` Paul Mackerras
2006-08-21 15:12 ` Arnd Bergmann
2006-08-21 15:17 ` Russell King
2006-08-22 7:29 ` Benjamin Herrenschmidt
2006-08-22 8:00 ` Björn Steinbrink
2006-08-22 10:06 ` Arnd Bergmann
2006-08-22 13:39 ` Jeff Dike
2006-08-22 15:13 ` Arnd Bergmann
2006-08-22 15:37 ` Jeff Dike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060819084233.GA25767@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=B.Steinbrink@gmx.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox