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: <4997c865-fc6f-4d8c-b73f-a649b6257ed0@app.fastmail.com>
Date: Mon, 19 Feb 2024 08:56:59 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Kent Overstreet" <kent.overstreet@...ux.dev>
Cc: "Calvin Owens" <jcalvinowens@...il.com>,
 "Russell King" <linux@...linux.org.uk>, "Dave Martin" <Dave.Martin@....com>,
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
 "linux-bcachefs@...r.kernel.org" <linux-bcachefs@...r.kernel.org>
Subject: Re: [PATCH] arm: Silence gcc warnings about arch ABI drift

On Mon, Feb 19, 2024, at 07:25, Kent Overstreet wrote:
> On Mon, Feb 19, 2024 at 07:21:11AM +0100, Arnd Bergmann wrote:
>> 
>> This is not something that should ever be passed by value
>> into a function.
>
> Why?

Mostly because of the size, as 8 registers (on 32-bit) or
4 registers (on 64 bit) mean that even in the best case
passing these through argument registers is going to cause
spills if anything else gets passed as well. Passing them
through the stack in turn requires the same number of
registers to get copied in and out for every call, which
in turn can evict other registers that hold local variables.

On top of that, you have all the complications that make
passing them inconsistent and possibly worse depending
on how exactly a particular ABI passes structures:

- If each struct member is passed individually, you always
  need eight registers
- bitfields tend to get the compiler into corner cases
  that are not as optimized
- __u64 members tend to need even/odd register pairs on
  many 32-bit architectures.
- on big-endian kernels, two __u64 members are
  misaligned, which causes them to be in two halves
  of separate registers if the struct gets passed as
  four 64-bit regs.
  
I can't think of any platform where passing the structure
through a const pointer ends up worse than passing
by value.

    Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ