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: <ZyEFyV28jcz85V1q@localhost.localdomain>
Date: Tue, 29 Oct 2024 16:56:57 +0100
From: Frederic Weisbecker <frederic@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
	Anna-Maria Behnsen <anna-maria@...utronix.de>,
	John Stultz <jstultz@...gle.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>, Stephen Boyd <sboyd@...nel.org>,
	Eric Biederman <ebiederm@...ssion.com>,
	Oleg Nesterov <oleg@...hat.com>
Subject: Re: [patch V5 16/26] signal: Replace resched_timer logic

Le Tue, Oct 01, 2024 at 10:42:21AM +0200, Thomas Gleixner a écrit :
> In preparation for handling ignored posix timer signals correctly and
> embedding the sigqueue struct into struct k_itimer, hand down a pointer to
> the sigqueue struct into posix_timer_deliver_signal() instead of just
> having a boolean flag.
> 
> No functional change.
> 
> Suggested-by: Eric W. Biederman <ebiederm@...ssion.com>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

On second thoughts, a little concern:

> ---
> V5: New patch
> ---
>  include/linux/posix-timers.h |    5 +++--
>  kernel/signal.c              |   24 ++++++++++++------------
>  kernel/time/posix-timers.c   |    2 +-
>  3 files changed, 16 insertions(+), 15 deletions(-)
> 
> --- a/include/linux/posix-timers.h
> +++ b/include/linux/posix-timers.h
> @@ -110,7 +110,7 @@ static inline void posix_cputimers_rt_wa
>  void posixtimer_rearm_itimer(struct task_struct *p);
>  bool posixtimer_init_sigqueue(struct sigqueue *q);
>  int posixtimer_send_sigqueue(struct k_itimer *tmr);
> -bool posixtimer_deliver_signal(struct kernel_siginfo *info);
> +bool posixtimer_deliver_signal(struct kernel_siginfo *info, struct sigqueue *timer_sigq);
>  void posixtimer_free_timer(struct k_itimer *timer);
>  
>  /* Init task static initializer */
> @@ -135,7 +135,8 @@ static inline void posix_cputimers_init(
>  static inline void posix_cputimers_group_init(struct posix_cputimers *pct,
>  					      u64 cpu_limit) { }
>  static inline void posixtimer_rearm_itimer(struct task_struct *p) { }
> -static inline bool posixtimer_deliver_signal(struct kernel_siginfo *info) { return false; }
> +static inline bool posixtimer_deliver_signal(struct kernel_siginfo *info,
> +					     struct sigqueue *timer_sigq) { return false; }
>  static inline void posixtimer_free_timer(struct k_itimer *timer) { }
>  #endif
>  
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -545,7 +545,7 @@ bool unhandled_signal(struct task_struct
>  }
>  
>  static void collect_signal(int sig, struct sigpending *list, kernel_siginfo_t *info,
> -			   bool *resched_timer)
> +			   struct sigqueue **timer_sigq)
>  {
>  	struct sigqueue *q, *first = NULL;
>  
> @@ -568,10 +568,10 @@ static void collect_signal(int sig, stru
>  		list_del_init(&first->list);
>  		copy_siginfo(info, &first->info);
>  
> -		*resched_timer = (first->flags & SIGQUEUE_PREALLOC) &&
> -				 (info->si_code == SI_TIMER);
> -
> -		__sigqueue_free(first);
> +		if (unlikely((first->flags & SIGQUEUE_PREALLOC) && (info->si_code == SI_TIMER)))
> +			*timer_sigq = first;
> +		else
> +			__sigqueue_free(first);

So this isn't calling __sigqueue_free() unconditionally anymore. What if
the timer has been freed already, what is going to free the sigqueue?

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ