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:   Wed, 12 Jan 2022 10:24:13 -0500 (EST)
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     David Laight <David.Laight@...LAB.COM>
Cc:     Christian Brauner <christian.brauner@...ntu.com>,
        Christian Brauner <brauner@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        paulmck <paulmck@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
        "H. Peter Anvin" <hpa@...or.com>, Paul Turner <pjt@...gle.com>,
        linux-api <linux-api@...r.kernel.org>,
        Florian Weimer <fw@...eb.enyo.de>, carlos <carlos@...hat.com>
Subject: Re: [RFC PATCH v2 1/2] rseq: x86: implement abort-at-ip extension

----- On Jan 12, 2022, at 10:15 AM, David Laight David.Laight@...LAB.COM wrote:

> From: Mathieu Desnoyers
>> Sent: 12 January 2022 15:06
>> 
>> ----- On Jan 12, 2022, at 9:58 AM, David Laight David.Laight@...LAB.COM wrote:
>> 
>> >>  * [*] The openrisc, powerpc64 and x86-64 architectures define a "redzone" as a
>> >>  *     stack area beyond the stack pointer which can be used by the compiler
>> >>  *     to store local variables in leaf functions.
>> >
>> > I wonder if that is really worth the trouble it causes!
>> > By the time a function is spilling values to stack the cost
>> > of a %sp update is almost certainly noise.
>> >
>> > Someone clearly thought it was a 'good idea (tm)'.
>> 
>> I must admit that I've been surprised to learn about these redzones. Thanks for
>> pointing them out to me, it was clearly a blind spot. I suspect it would be
>> useful
>> to introduce per-architecture KERNEL_REDZONE, USER_REDZONE and
>> COMPAT_USER_REDZONE
>> with a asm-generic version defining them to 0, with proper documentation. It
>> would
>> make it clearer to kernel developers working on stuff similar to signal handler
>> delivery that they need to consider these carefully.
> 
> They can never be used in kernel - any ISR would overwrite them.

arch/powerpc/include/asm/ptrace.h define those for ppc64:

113:#define USER_REDZONE_SIZE	512
114:#define KERNEL_REDZONE_SIZE	288

and then uses the kernel redzone size for:

#define STACK_INT_FRAME_SIZE    (sizeof(struct pt_regs) + \
                                 STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)

which AFAIU should ensure that ISR don't overwrite the redzone within the kernel.

Thanks,

Mathieu

> 
>	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT,
> UK
> Registration No: 1397386 (Wales)

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ