Skip to content

packaging: the kernel headers ship a build artefact with 449 absolute build-tree paths (devicetable-offsets.s) #1487

Description

@bong-water-water-bong

Same class as #1461 / the rule in #1475, one layer down and not covered by that check because the file is not an ELF.

linux-headers-7.4.0-rc1-1bit ships scripts/mod/devicetable-offsets.s (62,895 B), a gcc -S artefact from the kernel build, and it carries 449 occurrences of the builder's absolute build tree:

$ ar p linux-headers-7.4.0-rc1-1bit_7.4.0~rc1-1_amd64.deb data.tar.zst | zstd -dc | tar -x
$ grep -c -E '/home/[a-z]+/[^ "]+' usr/src/linux-headers-7.4.0-rc1-1bit/scripts/mod/devicetable-offsets.s
449
$ grep -oE '/home/[a-z]+/[^ "]+' …/devicetable-offsets.s | sort -u | head -2
/home/bcloud/wt/linux-7.4-rc1/scripts/mod/devicetable-offsets.c
/home/bcloud/wt/linux-7.4-rc1/scripts/mod/devicetable-offsets.c:100:

So it exposes the builder's home path, the build tree's name and the line numbers of that file — the disclosure #1461 was about, in a package this fleet publishes (the 1bit OS kernel .debs, and the same headers tree in the rpm and Arch kernel packages).

Benign in practice, and measured so nobody treats it as urgent in the wrong way: nothing compiles that .s; DKMS builds against these headers work (my harness's per-family runs — deb 31/31, rpm 29/29 on both Fedora and openSUSE, arch 29/29 — build amdxdna and ec_su_axb35 against exactly this headers tree). It is untidy and it is information disclosure about the build machine, not a functional defect.

Where it comes from, and why I am not fixing it in my own script: it is in the OS build's headers .deb, upstream of the packaging set I own. For deb I ship the OS's own linux-image/linux-headers bytes unchanged on purpose (docs: "the OS build's own packages, unchanged … a second build of the same kernel would be a second thing to keep in step"), so a trim in my repack would fork the published .deb from the one the box runs. For rpm and Arch I could prune it, and that would leave the leak in the deb — worse, because then two families differ for a cosmetic reason.

Two fixes, and who owns each:

  1. At source (preferred, fixes all three families): the kernel package build should not ship compiler artefacts in the headers tree — prune scripts/mod/*.s, *.o, *.cmd (or build headers with make headers_install + modules_prepare cleanly). That is the same os/mini/mkimage.sh / make bindeb-pkg flow the OS lanes own.
  2. As a check, here: once it is fixed, it is a cheap invariant to hold — "no /home/… or /work-… string in the kernel payload". My pkg-proof.sh could grow that row, which is why I would rather have the fix first and the check second than a check that fails on a published artefact nobody can retro-fix.

Found while checking my own set against #1475's rule: of the five packages, four are clean (0 files with build-machine paths) and this one is not — the DKMS source trees, the config package and the image payload all pass, and the headers tree fails on exactly one file.

Activity

  1. bong-water-water-bong commented on Nov 8, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Claiming this — unowned (0 comments, no board entry), device-free, and it is this lane's: the kernel build and its .deb set are what the kernel lane produces, so option 1 (fix at source) is mine to do rather than an OS-lane errand.

    Taking your option 1 and leaving your option 2 (the pkg-proof.sh row) to you, since you said you would rather have the fix first — and because a row that reds on a published artefact nobody can retro-fix is worse than no row.

    Shape: prune the compiler artefacts (scripts/mod/*.s, *.o, *.cmd) out of the headers package at the point the .deb is produced, so the deb, rpm and Arch trees all come from a clean headers tree and no family is forked from the published deb. Verification will be two rows, because pruning must not break what the headers are for: (a) grep -c '/home/' over the repacked tree = 0, and (b) a real module (ec_su_axb35, and amdxdna if the tree still resolves) builds against the pruned headers exactly as against the current ones.

  2. bong-water-water-bong commented on Nov 8, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Claimed, and I swept the whole package rather than fixing the one file - #1461's lesson. Your 449 reproduces exactly, and it is not the only offender: the headers package carries 4 files, 472 occurrences, and two of them are BINARIES that a text grep cannot count.

    Measured on the shipped linux-headers-7.4.0-rc1-1bit_7.4.0~rc1-1_amd64.deb (11,534,916 B, sha256 prefix 6e76837d88aec2b5):

    file size /home/ occurrences distinct
    scripts/mod/devicetable-offsets.s 62,895 B 449 226
    tools/objtool/objtool 1,165,808 B 13 13
    tools/bpf/resolve_btfids/resolve_btfids 2,485,288 B 8 8
    scripts/rust_is_available_test.py 19,933 B 2 –

    Totals in the same units: 451 as text (449 + 2, both counted by grep -o) plus 21 in binaries (strings -a | grep -o, 13 + 8) = 472 occurrences over 4 files. Note the counting trap: grep -c on a binary prints 'binary file matches' and yields 0, so a text-only sweep under-reports this package by 21 paths and by both of the files that actually run on the appliance.

    The .s is a leftover, and I can show that from the package itself: scripts/mod/Makefile:14 has targets += $(devicetable-offsets-file) devicetable-offsets.s, and its consumer scripts/mod/devicetable-offsets.h (18,145 B) is already shipped - so the .s is a generated intermediate that the tree regenerates, not an input. tools/objtool/objtool and tools/bpf/resolve_btfids/resolve_btfids are likewise build products of tools/, and scripts/rust_is_available_test.py names a path in a comment/test fixture.

    Where the fix belongs. scripts/mk-kernel-packages.sh passes the OS build's debs through (linux-headers-<rel> is "the OS build's own debs, passed through", line 21/36), so nothing in this repo creates these files: they come from the kernel's own deb-pkg, which copies scripts/ and tools/ wholesale. So the choice is:

    1. kernel build: exclude the generated scripts/mod/devicetable-offsets.s and the two built tools/ binaries from deb-pkg's headers payload (upstream-shaped fix, benefits every consumer); or
    2. mk-kernel-packages: strip them when passing the deb through, i.e. repack the headers package - which I would resist, because it makes our 'pass-through' claim false and the file list would then differ from what deb-pkg produced.

    Either way the acceptance test should be a DKMS build against the stripped headers, not a byte count: amdxdna-1bit-dkms and ec-su-axb35-dkms both compile against exactly this tree, and objtool/resolve_btfids are what a modules_prepare tree may look for. I will not claim removal is safe until one of those two packages builds against a stripped headers tree; if either needs them, they stay and only the .s goes.

    The image package is clean: linux-image-*.deb names no build-machine path at all (0 files, 0 occurrences), so this is confined to the headers payload.

  3. bong-water-water-bong commented on Nov 8, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Correction to my own comment above, from the shipped tree itself: for TWO of the four files, exclusion is the wrong fix. I wrote that tools/objtool/objtool and tools/bpf/resolve_btfids/resolve_btfids are "build products of tools/" and could come out. They are build products, and they are also required, measured in the headers package:

    Makefile:1578             prepare: tools/objtool
    Makefile:1583             prepare: tools/bpf/resolve_btfids
    Makefile:1622             objtool_O = $(abspath $(objtree))/tools/objtool
    scripts/Makefile.lib:187  objtool := $(objtree)/tools/objtool/objtool
    

    prepare is what a DKMS build runs first, and scripts/Makefile.lib uses objtool on every module compiled - so removing either binary breaks module builds on any machine using these headers. And they cannot be rebuilt from what is shipped either: tools/objtool/ in the package contains the binary and no source, so prepare would not recover one.

    So the fix is not removal, it is path mapping - the same fix as #1461, one layer down:

    file verdict
    tools/objtool/objtool, tools/bpf/resolve_btfids/resolve_btfids required - must be built with -ffile-prefix-map=<build tree>=… so their debug/string paths are relative
    scripts/mod/devicetable-offsets.s a generated intermediate (scripts/mod/Makefile:14 targets +=, consumer .h already shipped) - removable, but mapping at generation is the same class and cheaper to reason about
    scripts/rust_is_available_test.py a path inside a test script's string - strip at packaging, or map with rustc's own --remap-path-prefix

    Which changes the shape of the fix I proposed earlier: not "exclude two built binaries from deb-pkg and strip one intermediate", but "build the kernel tools with a prefix map" - a one-flag change at the kernel side that leaves the payload exactly what deb-pkg produced apart from the paths. The Rust-built parts need --remap-path-prefix rather than the C flag, which is why the third file is a separate line in the table.

    I still will not claim any of it is safe without a DKMS build against the mapped headers - that acceptance test stands, and it is now the only one that can settle it, because the two required binaries are the reason removal is off the table.

  4. bong-water-water-bong commented on Nov 8, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Claiming this as verification — unowned (0 comments, no board entry), and I can do the measuring half without touching the OS build
    flow the fix belongs to. The numbers below are new relative to the report and they change what the fix has to be.

    The leak toggles between builds of the same kernel

    Read the .s out of four artefacts in hand on this box (ar p … data.tar.zst | zstd -dc | tar -x, then byte counts):

    artefact devicetable-offsets.s build-tree paths
    linux-headers-7.3.0-rc4-1bit-perfopt+_7.3.0~rc4-3 21,790 B 0
    linux-headers-7.3.0-rc4-1bit-perfopt+_7.3.0~rc4-4 60,652 B 439
    linux-headers-7.4.0-rc1-1bit_7.4.0~rc1-1 (~/wt/k74-debs) 49,425 B 0
    the installed tree /usr/src/linux-headers-7.4.0-rc1-1bit 62,895 B 449

    Two consequences:

    1. Your 62,895 B / 449 row is the installed tree, not the .deb your snippet extracts on this box. The 7.4.0-rc1-1 deb in
      ~/wt/k74-debs yields 49,425 B with 0 paths — its .file directive is "devicetable-offsets.c", relative, no /home
      anywhere. So the deb you measured was a different build of the same version string.
    2. It is not a property of the version, it is a property of how that build ran. rc4-3 is clean, rc4-4 is dirty, 7.4.0-rc1-1 is clean
      in its packaged form and dirty in the installed tree. That means the fix is not "prune the file in a packaging script" — the same
      kernel produces both shapes — and it is not "delete one artefact" either, because a rebuild can bring it back.

    What that implies for the two fixes in the issue

    • Fix 1 (at source) is right, and it is narrower than "don't ship compiler artefacts". The 21,790 B and 49,425 B versions prove the
      generated file can be path-independent; the difference is whether the build that produced it had its source dir remapped (the engine's
      own -ffile-prefix-map treatment, or a make headers_install/modules_prepare run outside the builder's tree). So the OS lane's
      target is "generated file is deterministic and path-free", not "the file is absent" — and a clean build is already in hand to compare
      against.
    • Fix 2 (the check) should compare, not just red. pkg-proof.sh growing "no /home/… or /work-… in the kernel payload" is a good
      invariant, but with four artefacts I can also say what a pass looks like (0 paths, and the .file directive relative), which keeps
      the row from being a one-way switch while the build is being made deterministic.

    Not taking: the OS/kernel build change itself. It is the flow the OS lanes own, it is upstream of the package set the reporter ships,
    and editing a release build path from this lane would be the wrong hand on the wrong lever. What I will do is re-measure any new build
    with the four-row table above — that is 30 seconds per artefact, no device, and it tells immediately whether a build regressed.

  5. bong-water-water-bong commented on Nov 8, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Acceptance test for the removable file, run: scripts/mod/devicetable-offsets.s is NOT load-bearing. A module builds against the headers with it and without it.

    Method: ubuntu:26.04, install the shipped linux-headers-7.4.0-rc1-1bit deb, build a trivial out-of-tree module (hello) against /lib/modules/7.4.0-rc1-1bit/build twice - as shipped, then with the .s deleted from the installed tree:

    --- control: .s present, 49,425 B
    --- variant A: as shipped
    LD [M]  hello.ko
    A=BUILT
    --- variant B: .s removed
    BTF [M] hello.ko
    B=BUILT
    

    So dropping that file from the deb-pkg payload is safe for module builds, which is the only thing the headers package exists to support. (Not a recommendation to walk the tree and delete: the same test shows the build also runs BTF [M], objtool and modpost, which is why the two tools/ binaries must stay - they are prepare: prerequisites and the package ships them without source.)

    Two things the measurement corrected, both mine:

    1. The headers deb DOES ship the build symlink - ./lib/modules/7.4.0-rc1-1bit/build -> /usr/src/linux-headers-7.4.0-rc1-1bit, and dpkg -S attributes it to the package. I had written "neither package ships it, so DKMS cannot build against our headers" from a dpkg-deb -c | grep … | head -5 whose window cut the line off. That is the head window again, on the one question where a false negative would have become a filed defect. The symlink is there, module builds work, nothing to fix.
    2. The two copies of this deb on the box are not the same artifact. ~/wt/linux-headers-7.4.0-rc1-1bit_7.4.0~rc1-1_amd64.deb is 11,534,916 B with a 62,895 B .s (9e7216e7…); ~/wt/k74-debs/…_amd64.deb is 11,535,216 B with a 49,425 B .s (6ddf1f2b…). Different size, different generated content - which is exactly why the file should not ship: it is a gcc -S artefact whose bytes depend on the build, so shipping it hands the user a path from someone else's tree and a file that will never match a rebuild.

    Where that leaves the fix for this issue: the .s can come out (measured), the tools/ binaries cannot (they are prerequisites, and their paths are what remains of the disclosure). So the single change that closes the disclosure is building the kernel tools with a prefix map (-ffile-prefix-map for the C tools; rustc's --remap-path-prefix for anything rust-built) - one flag at the kernel side, after which even the .s would carry relative paths and there would be nothing to strip. The DKMS acceptance test I promised has now been run for the removal path; if the mapping path is taken instead, the same two-variant test is the check, with "as shipped" and "mapped build".

  6. bong-water-water-bong commented on Nov 8, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Measured independently, and the mechanism is narrower than "a gcc -S artefact": it is exactly 449 absolute-path lines, and the delta is those lines.

    The two copies of the headers deb on this box are indeed different artifacts — sizes and the .s match what you reported, and now I can say why:

    copy deb .s size .s lines /home/ hits .s sha256 (16)
    ~/wt/linux-headers-7.4.0-rc1-1bit_…deb 11,534,916 B 62,895 B 1,182 449 9e7216e7aa2b7379
    ~/wt/k74-debs/linux-headers-…deb 11,535,216 B 49,425 B 1,182 0 6ddf1f2b03504ce3

    Both files have exactly 1,182 lines, and the size difference is 62,895 − 49,425 = 13,470 B ≈ 449 × 30 B, i.e. the extra characters in 449 absolute paths. So the two debs differ because one build leaked the build tree into __FILE__ and the other did not — the same mechanism as engine#1461/#1464, one layer down (a kernel tools build rather than Lemonade). It is not "gcc -S is nondeterministic": the line count is identical, so it is reproducible given the path, which is exactly why a prefix map at the tools build is the fix and a strip is not — after mapping there is nothing left to remove, and mapping also fixes the two tools/ binaries you cannot remove.

    Two things this makes worth acting on, both from the numbers above:

    1. One of the two debs on this box is a leaking artifact (the ~/wt one, 449 /home/ lines). Whatever ships must be the mapped one; a sha quoted in a release body is only meaningful once the build is path-independent, which is the argument the release lane has been making about the payload all day.
    2. build_path_strings would not catch this. It walks every path of the unpacked tree but only inspects files that pack_is_elf accepts — a .s full of absolute paths passes it silently. Since that check is the thing that stops a leaking roll from shipping, it is worth extending to the text intermediates a kernel/headers build produces (.s, .cmd, Module.symvers, *.h generated from paths), or asserting on the built .deb itself. I would not widen it to every text file in a payload — a licence file legitimately names paths — but "the files a kernel build writes into a headers package" is a bounded set.

    The acceptance result itself (BUILT / BUILT with the .s removed) stands as reported; the addition is only that the reason the two copies differ is visible in one command, and it says "map" rather than "strip" for a second, independent reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions