From: Chase Venters <chase.venters@clientec.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Björn Steinbrink" <B.Steinbrink@gmx.de>,
"Russell King" <rmk+lkml@arm.linux.org.uk>,
"Andrew Morton" <akpm@osdl.org>,
rusty@rustcorp.com.au, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org
Subject: Re: [PATCH] introduce kernel_execve function to replace __KERNEL_SYSCALLS__
Date: Sun, 20 Aug 2006 12:36:49 -0500 [thread overview]
Message-ID: <200608201237.13194.chase.venters@clientec.com> (raw)
In-Reply-To: <200608201913.39989.arnd@arndb.de>
On Sunday 20 August 2006 12:13, Arnd Bergmann wrote:
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-cg/lib/execve.c 2006-08-20 19:06:00.000000000 +0200
> @@ -0,0 +1,19 @@
> +#include <asm/bug.h>
> +#include <asm/uaccess.h>
> +
> +#define __KERNEL_SYSCALLS__
> +static int errno;
> +#include <asm/unistd.h>
> +
> +int kernel_execve(const char *filename, char *const argv[], char *const
> envp[]) +{
> + mm_segment_t fs = get_fs();
> + int ret;
> +
> + WARN_ON(segment_eq(fs, USER_DS));
> + ret = execve(filename, (char **)argv, (char **)envp);
> + if (ret)
> + ret = errno;
> +
> + return ret;
> +}
I noticed this global errno in lib/errno.c a while ago and was wondering what
the right way to clean it up is. From what I remember, no one actually uses
errno in the kernel (unless it's an "errno" they've defined locally). The
only other place errno gets used is by all of the syscall macros.
Unless there's some TLS kernel magic that I've totally missed, using errno in
this manner is totally unsafe anyway. So I would NAK the above because your
kernel_execve() function gives an unsafe errno value significance it should
not have by turning it into a return value. (As an aside, shouldn't that have
read [ ret = -errno; ] anyway?)
Unless 'errno' has some significant reason to live on in the kernel, I think
it would be better to kill it and write kernel syscall macros that don't muck
with it.
Thanks,
Chase
next prev parent reply other threads:[~2006-08-20 17:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060819073031.GA25711@atjola.homenet>
[not found] ` <200608201501.29296.arnd@arndb.de>
[not found] ` <20060820134745.GA11843@atjola.homenet>
2006-08-20 17:13 ` [PATCH] introduce kernel_execve function to replace __KERNEL_SYSCALLS__ Arnd Bergmann
2006-08-20 17:36 ` Chase Venters [this message]
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=200608201237.13194.chase.venters@clientec.com \
--to=chase.venters@clientec.com \
--cc=B.Steinbrink@gmx.de \
--cc=akpm@osdl.org \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
--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