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:	Thu, 1 Aug 2013 13:30:50 +0200
From:	Stanislaw Gruszka <sgruszka@...hat.com>
To:	Dong Zhu <bluezhudong@...il.com>
Cc:	John Stultz <john.stultz@...aro.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...e.hu>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] posix_cpu_timers: fix timer never expires when executes
 clock_nanosleep

Hi Dong Zhu

On Thu, Aug 01, 2013 at 06:10:19PM +0800, Dong Zhu wrote:
> diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
> index c7f31aa..cc03290 100644
> --- a/kernel/posix-cpu-timers.c
> +++ b/kernel/posix-cpu-timers.c
> @@ -1413,9 +1413,9 @@ static int posix_cpu_nsleep(const clockid_t which_clock, int flags,
>  	/*
>  	 * Diagnose required errors first.
>  	 */
> -	if (CPUCLOCK_PERTHREAD(which_clock) &&
> -	    (CPUCLOCK_PID(which_clock) == 0 ||
> -	     CPUCLOCK_PID(which_clock) == current->pid))
> +	if (CPUCLOCK_PID(which_clock) == current->pid ||
> +	    (CPUCLOCK_PERTHREAD(which_clock) &&
> +	     CPUCLOCK_PID(which_clock) == 0))
>  		return -EINVAL;

Nope, this is wrong. We have to allow own pid process clock, because it
can be used correctly on multi-threaded processes. Own tid thread clock
has no sense and we correctly return -EINVAL in such case.

We could possibly add check for own pid together with check if process 
consist of one thread, but that is too complicated IMHO especially
taking into account that threads on the process can be destroyed and
created dynamically.

Stanislaw

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