Re: [PATCH bpf-next] kbuild, bpf: reproducible BTF from pahole when KBUILD_BUILD_TIMESTAMP set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 2, 2024 at 6:49 PM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote:
>
> On 02/07/2024 08:58, Masahiro Yamada wrote:
> > On Tue, Jul 2, 2024 at 2:32 AM Alan Maguire <alan.maguire@xxxxxxxxxx> wrote:
> >>
> >> Reproducible builds [1] require that the same source code with
> >> the same set of tools can build identical objects each time,
> >> but pahole in parallel mode was non-deterministic in
> >> BTF generation prior to
> >>
> >> dba7b5e ("pahole: Encode BTF serially in a reproducible build")
> >>
> >> This was a problem since said BTF is baked into kernels and modules in
> >> .BTF sections, so parallel pahole was causing non-reproducible binary
> >> generation.  Now with the above commit we have support for parallel
> >> reproducible BTF generation in pahole.
> >>
> >> KBUILD_BUILD_TIMESTAMP is set for reproducible builds, so if it
> >> is set, add reproducible_build to --btf_features.
> >>
> >> [1] Documentation/kbuild/reproducible-builds.rst
> >>
> >> Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
> >
> >
> >
> >
> > Does not make sense.
> >
> >
> >
> > KBUILD_BUILD_TIMESTAMP is not a switch for
> > "please enable the reproducible build".
> >
> >
> > KBUILD_BUILD_TIMESTAMP requires the build code
> > to use the given time in the output where timestamps are used.
> >
> > Your patch does not use the timestamp at all.
> >
>
> No, and that's not the intention. It is used as a signal to pahole to
> enable reproducibility in parallel build. There is a cost to this so
> it's not advisable in all scenarios [1]. Is there a kbuild-approved way
> to determine if reproducible builds are in operation?
>
> Alan
>
> [1]
> https://lore.kernel.org/dwarves/20240412211604.789632-12-acme@xxxxxxxxxx/




Kbuild already provides a standard mechanism.





config DEBUG_INFO_BTF_REPRODUCIBLE
        bool "Generate reproducible BTF"
        depends on DEBUG_INFO_BTF
        depends on PAHOLE_VERSION >= 126



pahole-flags-$(CONFIG_DEBUG_INFO_BTF_REPRODUCIBLE) =
--btf_features=reproducible_build






Presumably, it is better to add a new section
in Documentation/kbuild/reproducible-builds.rst







--
Best Regards
Masahiro Yamada





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux