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: <894fc485-0a0f-479e-88e0-eddb9ccf065c@oracle.com>
Date: Wed, 28 Aug 2024 12:07:44 +0200
From: Vegard Nossum <vegard.nossum@...cle.com>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-omap@...r.kernel.org,
        kvmarm@...ts.linux.dev, kvm@...r.kernel.org,
        linux-um@...ts.infradead.org, bpf@...r.kernel.org,
        llvm@...ts.linux.dev
Subject: Re: [PATCH] kbuild: use objcopy to generate asm-offsets


On 28/08/2024 10:36, Vegard Nossum wrote:
> In order to give assembly code access to C structs without having to
> hardcore member offsets, the kernel compiles a C source file listing all
> the structs and offsets that are needed in assembly code. Using some
> C preprocessor trickery and a sed script, the compiled assembly code is
> turned back into C preprocessor code that in turn can be used by the
> asssembly code.
> 
> This sed script is very hard to read and understand.
> 
> Remove the sed script and compile the C source listing structs and
> offsets to an object file (instead of assembly code) that embeds C source
> directly. Then extract the C source using objcopy.
> 
> The resulting code is more readable, less fragile, and sligthly shorter.
> 
> Note to reviewers: The 'objcopy ... /dev/stdout | cat' bit is needed to
> force the correct ordering of the objcopy lines vs. the surrounding echo
> commands; without it, objcopy will open /dev/stdout (which refers to a
> temporary file created by kbuild) and reset the file offset to 0. In
> other words, the pipe ensures that objcopy doesn't overwrite the lines
> that already exist in /dev/stdout.

Turns out LLVM's objcopy doesn't support writing to /dev/stdout, so we
might have to use a temporary file. I'll look into it and send a v2.


Vegard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ