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, 21 Mar 2024 12:07:51 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Russell King' <linux@...linux.org.uk>, Ard Biesheuvel <ardb@...nel.org>
CC: 'Jiangfeng Xiao' <xiaojiangfeng@...wei.com>, "arnd@...db.de"
	<arnd@...db.de>, "keescook@...omium.org" <keescook@...omium.org>,
	"haibo.li@...iatek.com" <haibo.li@...iatek.com>,
	"angelogioacchino.delregno@...labora.com"
	<angelogioacchino.delregno@...labora.com>, "amergnat@...libre.com"
	<amergnat@...libre.com>, "akpm@...ux-foundation.org"
	<akpm@...ux-foundation.org>, "dave.hansen@...ux.intel.com"
	<dave.hansen@...ux.intel.com>, "douzhaolei@...wei.com"
	<douzhaolei@...wei.com>, "gustavoars@...nel.org" <gustavoars@...nel.org>,
	"jpoimboe@...nel.org" <jpoimboe@...nel.org>, "kepler.chenxin@...wei.com"
	<kepler.chenxin@...wei.com>, "kirill.shutemov@...ux.intel.com"
	<kirill.shutemov@...ux.intel.com>, "linux-hardening@...r.kernel.org"
	<linux-hardening@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "nixiaoming@...wei.com"
	<nixiaoming@...wei.com>, "peterz@...radead.org" <peterz@...radead.org>,
	"wangbing6@...wei.com" <wangbing6@...wei.com>, "wangfangpeng1@...wei.com"
	<wangfangpeng1@...wei.com>, "jannh@...gle.com" <jannh@...gle.com>,
	"willy@...radead.org" <willy@...radead.org>
Subject: RE: [PATCH v2] ARM: unwind: improve unwinders for noreturn case

From: Russell King
> Sent: 21 March 2024 11:24
> 
> On Thu, Mar 21, 2024 at 10:22:30AM +0000, David Laight wrote:
> > How aggressively does the compiler optimise 'noreturn' functions?
> 
> I've seen cases where the compiler emits a BL instruction as the very
> last thing in the function, and nothing after it.

I've also seen the compiler defer generating a stack frame until
after an initial conditional.
That might mean you can get the BL in the middle of a function
but where the following instruction is for the 'no stack frame'
side of the branch.
That is very likely to break any stack offset calculations. 

> This is where the problem lies - because the link register value
> created by the BL instruction will point to the instruction after the
> BL which will _not_ part of the function that invoked the BL. That
> will probably cause issues for the ELF unwinder, which means this
> issue probably goes beyond _just_ printing the function name.

Isn't this already in the unwinder?
A BL itself isn't going to fault with PC = next-instruction.

For pretty much all code isn't *(LR-4) going to be BL?
On arm that is probably testable.
(It is pretty much impossible to detect a ACLL on x86.)
If it is a direct BL then you'd normally expect to the be
a call the function containing the current 'PC'.
The obvious exception is if there was a tail call, and printing
the called address would then be useful.
(It might help with leaf functions that don't generate a stack frame.)

I remember issues with the solaris sparc backtrace that used to
get confused by leaf functions...

> I have vague memories that Ard has been involved in the unwinder,
> maybe he could comment on this problem? Maybe we need the unwinder
> itself to do the correction? I also wonder whether we should only
> do the correction if we detect that we're pointing at the first
> instruction of a function, and the previous instruction in the
> text segment was a BL.

It might be enough to depend on whether the address is that of a
fault (where the instruction could be retried) or from a call/trap
instruction where it will be the following instruction.

	David

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ