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: <CAK7LNATLf2iXNGi-UKRg=+PRRqgmxry5QQnQ4GUNsuVmDBAnmw@mail.gmail.com>
Date: Sat, 8 Mar 2025 03:54:20 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, linux-kbuild@...r.kernel.org, 
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [RFC PATCH 0/4] x86/build: Get rid of vmlinux postlink step

On Fri, Mar 7, 2025 at 1:47 AM Ard Biesheuvel <ardb@...nel.org> wrote:
>
> On Mon, 24 Feb 2025 at 14:21, Ard Biesheuvel <ardb+git@...gle.com> wrote:
> >
> > From: Ard Biesheuvel <ardb@...nel.org>
> >
> > Kbuild supports an architecture specific Makefile.postlink file that is
> > invoked for the vmlinux target after it has been built. This Makefile
> > takes 'vmlinux' (which has just been built) as the target, and mangles
> > the file and/or constructs other intermediate artifacts from it.
> >
> > This violates the general philosophy of Make, which is based on rules
> > and dependencies, and artifacts that are rebuilt only when any of their
> > dependencies have been updated.
> >
> > Instead, the different incarnations of vmlinux that are consumed by
> > different stages of the build should be emitted as distinct files, where
> > rules and dependencies are used to define one in terms of the other.


In my understanding, the build rule of vmlinux is atomic
because vmlinux embeds a timestamp and a build version.

Now, you are splitting it into two stages.

vmlinux.unstripped (this includes timestamp and the build version)
  --(cmd_strip_relocs)-->  vmlinux


When cmd_strip_relocs is changed, only vmlinux is updated.
This changes the content of vmlinux, but its timestamp and build version
remain the same.

So, I am not sure if this is the right direction.


You can see more steps for updating vmlinux.
Do you believe the build rule should be further split into
more fine-grained stages?

For example,

vmlinux.pre-sort  (this includes timestamp and the build version)
   --(scripts/sortable)-->
vmlinux.unstripped
   --(cmd_strip_relocs)-->
vmlinux

But, again, even when sorttable is changed,
the timestamp and the build version remain the same.


Yeah, arch/*/Makefile.postlink is a crap
where arch maintainers build a fence
and start whatever they want to do.

If they completely disappear, I would love it.

However, this seems a partial clean-up
within the scope you are interested in.
(more specifically your motivation is because Linus pointed out
a failure in arch/x86/Makefile.postlink deleted vmlinux)






> > This also works around an error observed here [0], where vmlinux is
> > deleted by Make because a subsequent step that consumes it as input
> > throws an error.
> >
> > So refactor the vmlinux shell scripts and build rules so that
> > architectures that rely on --emit-relocs to construct vmlinux with
> > static relocations preserved will get a separate vmlinux.unstripped file
> > carrying those relocations. This removes the need for an imperative
> > postlink step, given that any rules that depend on the unstripped
> > vmlinux can now simply depend on vmlinux.unstripped, rather than inject
> > a build step into Makefile.postlink
> >
> > S390 should be able to do the same. MIPS and RISC-V perform some
> > post-build checks on vmlinux, which is reasonable in principle for a
> > postlink step, although deleting vmlinux when the check fails is equally
> > unhelpful.
> >
> > [0] https://lore.kernel.org/all/Z5ARucnUgqjwBnrp@gmail.com/T/#m731ed0206949fc3f39fcc8a7b82fe348a8fc80c4
> >
> > Cc: Masahiro Yamada <masahiroy@...nel.org>
> > Cc: Ingo Molnar <mingo@...nel.org>
> >
> > Ard Biesheuvel (4):
> >   Kbuild/link-vmlinux.sh: Make output file name configurable
> >   Kbuild: Introduce Kconfig symbol for linking vmlinux with relocations
> >   Kbuild: Create intermediate vmlinux build with relocations preserved
> >   x86: Get rid of Makefile.postlink
> >
>
> Ping?




-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ