lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200608201237.13194.chase.venters@clientec.com>
Date:	Sun, 20 Aug 2006 12:36:49 -0500
From:	Chase Venters <chase.venters@...entec.com>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Björn Steinbrink <B.Steinbrink@....de>,
	Russell King <rmk+lkml@....linux.org.uk>,
	Andrew Morton <akpm@...l.org>, rusty@...tcorp.com.au,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH] introduce kernel_execve function to replace __KERNEL_SYSCALLS__

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ