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] [day] [month] [year] [list]
Date:   Sun, 26 Sep 2021 21:58:35 +0900
From:   Stafford Horne <shorne@...il.com>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        LKML <linux-kernel@...r.kernel.org>,
        Victor Stinner <vstinner@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        GLIBC patches <libc-alpha@...rceware.org>
Subject: Re: [PATCH] posix-cpu-timers: Fix spuriously armed 0-value itimer

Hello,

Ccing libc-alpha,

On Mon, Sep 13, 2021 at 04:53:32PM +0200, Frederic Weisbecker wrote:
> Resetting/stopping an itimer eventually leads to it being reprogrammed
> with an actual "0" value. As a result the itimer expires on the next
> tick, triggering an unexpected signal.

Thanks for this I just tracked down the same issue.

I just wanted to give an FYI in case anyone else notices this.

This was causing gprof (gcc -pg) to fail.  I noticed this when running the glibc
test suite, tests: gmon/tst-gmon-static, gmon/tst-gmon

Gprof uses ITIMER_PROF, as per:

 - https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/posix/profil.c;h=fbf1184df1ccc6e1d2098f92c7d87fc28f5a8f09;hb=HEAD

I was seeing the extra SIGPROF signal after profil de-registered the timer and
signal handler.  The spurious signal causes all profiled programs to be killed
and collect no gprof data.

-Stafford

> To fix this, make sure that
> struct signal_struct::it[CPUCLOCK_PROF/VIRT]::expires is set to 0 when
> setitimer() passes a 0 it_value, indicating that the timer must stop.
> 
> Reported-by: Victor Stinner <vstinner@...hat.com>
> Fixes: 406dd42bd1ba ("posix-cpu-timers: Force next expiration recalc after itimer reset")
> Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> Cc: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
>  kernel/time/posix-cpu-timers.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
> index ee736861b18f..643d412ac623 100644
> --- a/kernel/time/posix-cpu-timers.c
> +++ b/kernel/time/posix-cpu-timers.c
> @@ -1404,7 +1404,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
>  			}
>  		}
>  
> -		*newval += now;
> +		if (*newval)
> +			*newval += now;
>  	}
>  
>  	/*
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ