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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150407100654.GA32743@redhat.com>
Date:	Tue, 7 Apr 2015 12:06:54 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	yury.norov@...il.com, rth@...ddle.net, ink@...assic.park.msu.ru,
	akpm@...ux-foundation.org, davem@...emloft.net
Cc:	klimov.linux@...il.com, linux-kernel@...r.kernel.org,
	linux-alpha@...r.kernel.org, linux-mips@...ux-mips.org,
	sparclinux@...r.kernel.org
Subject: Re: [PATCH] signal: optimize 'sigaction' call path

> There is a set of syscalls in the kernel about 'sigaction'.
> All they end up with calling the helper 'do_sigaction',
> so the generic scheme is:
>
> - copy user data to kernel;
> - 'do_sigaction';
> - copy kernel data to user.
>
> 'do_sigaction' checks 'signum' parameter before doing its main job.
> If this check fails syscall fails immediately, as well. But at this
> stage first copy is already done. And so there's a potential chance
> having it useless. It may affect performance significantly if user
> data was, say, swapped, and a fault was handled to obtain it.

Only if the signal number is wrong? So why do we care?

> In this patch, 'signum' sanity check is moved out of 'do_sigaction'
> to a small function 'user_signal'. So we can call it before any copying.
...
>  arch/alpha/kernel/signal.c       | 19 +++++++-------
>  arch/mips/kernel/signal.c        | 10 +++++---
>  arch/mips/kernel/signal32.c      | 10 +++++---
>  arch/sparc/kernel/sys_sparc32.c  | 10 ++++----
>  arch/sparc/kernel/sys_sparc_32.c | 10 ++++----
>  arch/sparc/kernel/sys_sparc_64.c | 10 ++++----
>  include/linux/sched.h            |  2 +-
>  include/linux/signal.h           |  5 ++++
>  kernel/signal.c                  | 54 +++++++++++++++++++++-------------------
>  9 files changed, 71 insertions(+), 59 deletions(-)

And this blows the source and compiled code. Not too much, but this
change should be justified somehow.

And to me this patch doesn't look like a cleanup, imho this sanity
check makes more sense in one place.

Oleg.

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