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: <20180725174228.Horde.-PsCOyKHj9skAHIMbqyLDg1@messagerie.si.c-s.fr>
Date:   Wed, 25 Jul 2018 17:42:28 +0200
From:   LEROY Christophe <christophe.leroy@....fr>
To:     Murilo Opsfelder Araujo <muriloo@...ux.ibm.com>
Cc:     linuxppc-dev@...ts.ozlabs.org, "Tobin C . Harding" <me@...in.cc>,
        Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
        Simon Guo <wei.guo.simon@...il.com>,
        Paul Mackerras <paulus@...ba.org>,
        Nicholas Piggin <npiggin@...il.com>,
        Michael Neuling <mikey@...ling.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        "Eric W . Biederman" <ebiederm@...ssion.com>,
        Cyril Bur <cyrilbur@...il.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Balbir Singh <bsingharora@...il.com>,
        Andrew Donnellan <andrew.donnellan@....ibm.com>,
        Alastair D'Silva <alastair@...ilva.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/7] powerpc/traps: Return early in show_signal_msg()

Murilo Opsfelder Araujo <muriloo@...ux.ibm.com> a écrit :

> Modify logic of show_signal_msg() to return early, if possible.  Replace
> printk_ratelimited() by printk() and a default rate limit burst to limit
> displaying unhandled signals messages.

Can you explain more the benefits of this change ?

Christophe

>
> Signed-off-by: Murilo Opsfelder Araujo <muriloo@...ux.ibm.com>
> ---
>  arch/powerpc/kernel/traps.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index cbd3dc365193..4faab4705774 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -301,6 +301,13 @@ void user_single_step_siginfo(struct task_struct *tsk,
>  	info->si_addr = (void __user *)regs->nip;
>  }
>
> +static bool show_unhandled_signals_ratelimited(void)
> +{
> +	static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
> +				      DEFAULT_RATELIMIT_BURST);
> +	return show_unhandled_signals && __ratelimit(&rs);
> +}
> +
>  static void show_signal_msg(int signr, struct pt_regs *regs, int code,
>  			    unsigned long addr)
>  {
> @@ -309,11 +316,12 @@ static void show_signal_msg(int signr, struct  
> pt_regs *regs, int code,
>  	const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \
>  		"at %016lx nip %016lx lr %016lx code %x\n";
>
> -	if (show_unhandled_signals && unhandled_signal(current, signr)) {
> -		printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32,
> -				   current->comm, current->pid, signr,
> -				   addr, regs->nip, regs->link, code);
> -	}
> +	if (!unhandled_signal(current, signr))
> +		return;
> +
> +	printk(regs->msr & MSR_64BIT ? fmt64 : fmt32,
> +	       current->comm, current->pid, signr,
> +	       addr, regs->nip, regs->link, code);
>  }
>
>  void _exception_pkey(int signr, struct pt_regs *regs, int code,
> @@ -326,7 +334,8 @@ void _exception_pkey(int signr, struct pt_regs  
> *regs, int code,
>  		return;
>  	}
>
> -	show_signal_msg(signr, regs, code, addr);
> +	if (show_unhandled_signals_ratelimited())
> +		show_signal_msg(signr, regs, code, addr);
>
>  	if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs))
>  		local_irq_enable();
> --
> 2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ