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]
Date:	Sun, 11 Oct 2009 20:03:38 +1100
From:	Benjamin Herrenschmidt <benh@...nel.crashing.org>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Vincent Sanders <vince@...tec.co.uk>,
	John Kacur <jkacur@...hat.com>,
	Jonathan Corbet <corbet@....net>,
	Christoph Hellwig <hch@...radead.org>,
	Tony Luck <tony.luck@...el.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [patch 21/28] bkl: pushdown BKL locking to do_sysctl()

On Sat, 2009-10-10 at 15:37 +0000, Thomas Gleixner wrote:
> plain text document attachment (push-bkl-to-do-sysctl.patch)
> Push lock/unlock_kernel() into do_sysctl() and remove it from all call
> sites of do_sysctl().
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Cc: Tony Luck <tony.luck@...el.com>
> Cc: Ralf Baechle <ralf@...ux-mips.org>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
> Cc: "David S. Miller" <davem@...emloft.net>

For the powerpc parts,

Acked-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>

> ---
>  arch/ia64/ia32/sys_ia32.c         |    2 --
>  arch/mips/kernel/linux32.c        |    2 --
>  arch/parisc/kernel/sys_parisc32.c |    2 --
>  arch/powerpc/kernel/sys_ppc32.c   |    2 --
>  arch/s390/kernel/compat_linux.c   |    2 --
>  arch/sparc/kernel/sys_sparc32.c   |    2 --
>  arch/x86/ia32/sys_ia32.c          |    2 --
>  kernel/sysctl.c                   |    6 ++++--
>  8 files changed, 4 insertions(+), 16 deletions(-)
> 
> Index: linux-2.6-tip/arch/ia64/ia32/sys_ia32.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/ia64/ia32/sys_ia32.c
> +++ linux-2.6-tip/arch/ia64/ia32/sys_ia32.c
> @@ -1670,10 +1670,8 @@ sys32_sysctl (struct sysctl32 __user *ar
>  		return -EFAULT;
>  
>  	set_fs(KERNEL_DS);
> -	lock_kernel();
>  	ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *) &oldlen,
>  			newvalp, (size_t) a32.newlen);
> -	unlock_kernel();
>  	set_fs(old_fs);
>  
>  	if (oldvalp && put_user (oldlen, (int __user *) compat_ptr(a32.oldlenp)))
> Index: linux-2.6-tip/arch/mips/kernel/linux32.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/mips/kernel/linux32.c
> +++ linux-2.6-tip/arch/mips/kernel/linux32.c
> @@ -302,10 +302,8 @@ SYSCALL_DEFINE1(32_sysctl, struct sysctl
>  		oldlenp = (size_t __user *)addr;
>  	}
>  
> -	lock_kernel();
>  	error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
>  			  oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
> -	unlock_kernel();
>  	if (oldlenp) {
>  		if (!error) {
>  			if (get_user(oldlen, (size_t __user *)addr) ||
> Index: linux-2.6-tip/arch/parisc/kernel/sys_parisc32.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/parisc/kernel/sys_parisc32.c
> +++ linux-2.6-tip/arch/parisc/kernel/sys_parisc32.c
> @@ -137,11 +137,9 @@ asmlinkage long sys32_sysctl(struct __sy
>  		oldlenp = (size_t *)addr;
>  	}
>  
> -	lock_kernel();
>  	error = do_sysctl((int __user *)(u64)tmp.name, tmp.nlen,
>  			  (void __user *)(u64)tmp.oldval, oldlenp,
>  			  (void __user *)(u64)tmp.newval, tmp.newlen);
> -	unlock_kernel();
>  	if (oldlenp) {
>  		if (!error) {
>  			if (get_user(oldlen, (size_t *)addr)) {
> Index: linux-2.6-tip/arch/powerpc/kernel/sys_ppc32.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/powerpc/kernel/sys_ppc32.c
> +++ linux-2.6-tip/arch/powerpc/kernel/sys_ppc32.c
> @@ -555,11 +555,9 @@ asmlinkage long compat_sys_sysctl(struct
>  			return -EFAULT;
>  	}
>  
> -	lock_kernel();
>  	error = do_sysctl(compat_ptr(tmp.name), tmp.nlen,
>  			  compat_ptr(tmp.oldval), oldlenp,
>  			  compat_ptr(tmp.newval), tmp.newlen);
> -	unlock_kernel();
>  	if (oldlenp) {
>  		if (!error) {
>  			if (get_user(oldlen, oldlenp) ||
> Index: linux-2.6-tip/arch/s390/kernel/compat_linux.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/s390/kernel/compat_linux.c
> +++ linux-2.6-tip/arch/s390/kernel/compat_linux.c
> @@ -562,10 +562,8 @@ asmlinkage long sys32_sysctl(struct __sy
>  		oldlenp = (size_t __user *)addr;
>  	}
>  
> -	lock_kernel();
>  	error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval),
>  			  oldlenp, compat_ptr(tmp.newval), tmp.newlen);
> -	unlock_kernel();
>  	if (oldlenp) {
>  		if (!error) {
>  			if (get_user(oldlen, (size_t __user *)addr) ||
> Index: linux-2.6-tip/arch/sparc/kernel/sys_sparc32.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/sparc/kernel/sys_sparc32.c
> +++ linux-2.6-tip/arch/sparc/kernel/sys_sparc32.c
> @@ -627,14 +627,12 @@ asmlinkage long sys32_sysctl(struct __sy
>  		oldlenp = (size_t __user *)addr;
>  	}
>  
> -	lock_kernel();
>  	error = do_sysctl((int __user *)(unsigned long) tmp.name,
>  			  tmp.nlen,
>  			  (void __user *)(unsigned long) tmp.oldval,
>  			  oldlenp,
>  			  (void __user *)(unsigned long) tmp.newval,
>  			  tmp.newlen);
> -	unlock_kernel();
>  	if (oldlenp) {
>  		if (!error) {
>  			if (get_user(oldlen, (size_t __user *)addr) ||
> Index: linux-2.6-tip/arch/x86/ia32/sys_ia32.c
> ===================================================================
> --- linux-2.6-tip.orig/arch/x86/ia32/sys_ia32.c
> +++ linux-2.6-tip/arch/x86/ia32/sys_ia32.c
> @@ -477,10 +477,8 @@ asmlinkage long sys32_sysctl(struct sysc
>  		return -EFAULT;
>  
>  	set_fs(KERNEL_DS);
> -	lock_kernel();
>  	ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *)&oldlen,
>  			newvalp, (size_t) a32.newlen);
> -	unlock_kernel();
>  	set_fs(old_fs);
>  
>  	if (oldvalp && put_user(oldlen, (int __user *)compat_ptr(a32.oldlenp)))
> Index: linux-2.6-tip/kernel/sysctl.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/sysctl.c
> +++ linux-2.6-tip/kernel/sysctl.c
> @@ -1848,6 +1848,8 @@ int do_sysctl(int __user *name, int nlen
>  			return -EFAULT;
>  	}
>  
> +	lock_kernel();
> +
>  	for (head = sysctl_head_next(NULL); head;
>  			head = sysctl_head_next(head)) {
>  		error = parse_table(name, nlen, oldval, oldlenp, 
> @@ -1858,6 +1860,8 @@ int do_sysctl(int __user *name, int nlen
>  			break;
>  		}
>  	}
> +
> +	unlock_kernel();
>  	return error;
>  }
>  
> @@ -1873,10 +1877,8 @@ SYSCALL_DEFINE1(sysctl, struct __sysctl_
>  	if (error)
>  		goto out;
>  
> -	lock_kernel();
>  	error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
>  			  tmp.newval, tmp.newlen);
> -	unlock_kernel();
>  out:
>  	return error;
>  }
> 


--
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