Skip to content

1bit-update: the new slot booted on the OLD release's kernel parameters - it now takes the new release's own line - #3465

Merged
bong-water-water-bong merged 1 commit into
mainfrom
fix/3374-update-new-cmdline
Nov 24, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
fix/3374-update-new-cmdline

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

The other slot's GRUB linux line was built from the running slot's line with only psubdir= replaced
(os/v3/puppy/embed/usr/local/bin/1bit-update:774-777 before this change), so every kernel parameter a release added,
dropped or changed after the machine was installed was lost by update. Measured on the issue's installed v2026.48
(updated from c35): /proc/cmdline carried no printk.always_kmsg_dump=1, although
os/v3/puppy/mkimage.sh:146,214 puts it on every image's line and refuses an image without it - that boot therefore
left no pstore record for #3306. A machine kept the parameters of the release it was installed from for its whole
life.

The release now carries its own headless parameters beside the set it ships, and the update builds the other slot's
entries from that line, putting back only the keys that name this machine.

The change

  • os/v3/puppy/mkimage.sh:152: ONE variable builds the image's linux lines and the release's own line;
    :244 writes it to /1bit/cmdline on the set the data partition ships (not in SHA256SUMS - it is a line of text
    an update reads, not a bootable file it installs), so the image's grub.cfg and the file cannot disagree. A release
    directory made from that /1bit carries it too.
  • os/v3/puppy/embed/usr/local/bin/1bit-update:490 boot_param / :496 release_headless /
    :506 slot_params read it - bare parameters or a whole linux <kernel> <params> line, CRLF and
    #/blank lines included - and merge: the release's parameters as they are, with this machine's pupsfs=UUID=,
    1bit.data=UUID= and psubdir=<target> taken from the running entry, and pfix=copy -> pfix=nocopy for an
    installed disk, exactly the set os/v3/puppy/1bit-install.sh:206-211 rewrites. A release that names a UUID pin the
    running line cannot fill in is refused by name: the image's own UUID would point the new slot at the release
    stick's partition.
  • 1bit-update:836-912 writes the slot's headless AND serial entries from that line. An entry that already exists
    is rewritten in place and keeps its own kernel path; a missing one is appended, so a slot written by
    1bit-install stops booting the installed release's parameters after an update and no entry accumulates. The
    image's desktop / install-to-disk entries are its own boot modes and are not touched. The written line is read back
    and compared with what this run wrote before set default moves (:912); a mismatch restores grub.cfg.
  • A release cut before this (no /1bit/cmdline) is updated exactly as before, and the update warns that a parameter
    this release changed does not arrive.

Evidence (ryzen, Release tree; no device, no VM, no reboot)

1. Control - origin/main's 1bit-update with THIS branch's test file (new test, old code)

$ git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > ~/.cache/scratch-3374/oldroot-3374/.../1bit-update
   # sha256 9b38558c2da05e41...  (origin/main = 1bb46320)
$ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh <that script>
...
FAIL the /1bit-alt boot line carries the NEW release's added parameter (printk.always_kmsg_dump=1; the installed line had none)
FAIL the /1bit-alt serial root shell entry carries it too
FAIL the update says where the /1bit-alt line came from
FAIL GRUB's default is /1bit and its line carries the parameter release B CHANGED (log_buf_len=64M, not 32M)
FAIL with this machine's UUID pin (not release B's) and release B's added parameter
FAIL the /1bit serial entry got the changed value too
FAIL the /1bit line is not the one 1bit-install wrote any more
FAIL the update says it rewrote the existing entries
control_rc=1, 26 ok / 8 FAIL

The line the old script wrote (release A's /1bit/cmdline carries printk.always_kmsg_dump=1; it does not arrive):

linux /1bit-alt/vmlinuz pmedia=atahd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt nvme.quirks=1e49:1081:dmapool_align_512 log_buf_len=32M

2. Branch - same test, same command, the tree's script

$ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh
/1bit-alt headless entry: linux /1bit-alt/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt log_buf_len=32M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0
ok   the /1bit-alt boot line carries the NEW release's added parameter (printk.always_kmsg_dump=1; the installed line had none)
ok   and THIS machine's data-partition pin (UUID=x), not the release image's own UUID
ok   pfix=copy from the image's line becomes nocopy, as 1bit-install writes for an installed disk
ok   the /1bit-alt serial root shell entry carries it too
ok   the RUNNING /1bit entry was not touched (the rollback keeps its own boot line)
...
/1bit headless entry: linux /1bit/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit log_buf_len=64M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0
ok   GRUB's default is /1bit and its line carries the parameter release B CHANGED (log_buf_len=64M, not 32M)
ok   the existing entry kept its own kernel path (/1bit/vmlinuz)
ok   the /1bit serial entry got the changed value too
ok   the /1bit desktop entry keeps the installed line (1bit-update writes a slot's headless and serial entries only)
ok   the existing entries were rewritten in place: still 6 menu entries, none duplicated
fix_rc=0, 34 ok / 0 FAIL

The fixture ESP is the image's real four-entry menu (headless, desktop, install-to-disk, serial), so the serial
line rewritten is entry 3 - not the entry next to the headless one - and the two modes 1bit-update does not own are
asserted byte-identical to what 1bit-install left.

3. Unit rows - tests/one_bit_update_slots_test.sh (sourced functions, no root)

branch:                                              33 ok, exit 0
origin/main script + this branch's rows:             23 ok / 10 FAIL, exit 1
   (slot_params / release_headless do not exist there)

4. ctest - the two rows this change touches

1/1 Test #55: one_bit_update_slots ... Passed    0.04 sec
1/1 Test #89: update_e2e_loop ...... Passed    0.77 sec     (as root; ONEBIT_E2E_TMP kept inside ~/.cache)

5. Gate

$ scripts/pre-pr-checks.sh --tree-only --base origin/main
pre-pr-checks: all 16 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)

The 2 skips are hip_f16_audit and kernel_id_selftest: no gpu-kernels tree on this box ($GPU_KERNELS_DIR unset).

What this does not cover

One real update followed by a boot on an installed machine (/proc/cmdline has the parameter, and the next boot
files the pstore record) needs hardware and a reboot; it was not run here. Everything host-side that can prove the
new slot's boot line is in place is above.

Review risks

  • pmedia is release-owned, not machine state. A machine whose installed line says pmedia=atahd (the e2e
    fixture's c35-era shape) gets the release's pmedia=usbhd on the updated slot. That is deliberate alignment, not a
    regression: os/v3/puppy/1bit-install.sh:220 installs disks with pmedia=usbhd on purpose (PUPMODE 12, writes
    straight to the layer), and a real installed disk therefore already carries usbhd.
  • The index the rewrite targets. slot_index treats "has psubdir=, no 1bit.serial=1" as headless, which
    also matches the image's desktop entry; it relies on the headless entry being first in the menu (mkimage writes it
    first, updates append headless-then-serial). That assumption is pre-existing, and the four-entry fixture now asserts
    the real artifact's indices instead of the old two-entry one.
  • A release cut before this change carries no /1bit/cmdline: it updates exactly as before (with a warning). The
    first release that actually delivers changed parameters is the first image cut with the new mkimage.sh.

Refs #3374

…rs - it now takes the new release's own line

The other slot's GRUB `linux` line was built from the RUNNING slot's line with only psubdir= replaced
(os/v3/puppy/embed/usr/local/bin/1bit-update:774-777 before this change). So every kernel parameter a release added,
dropped or changed after the machine was installed was lost by update. Measured on the issue's installed v2026.48
(updated from c35): /proc/cmdline carried no printk.always_kmsg_dump=1, although mkimage.sh puts it on every image's
line and refuses an image without it (os/v3/puppy/mkimage.sh:146,214) - that boot therefore left no pstore record for
#3306. An install carries the parameters of the release it was installed from for the machine's whole life.

The release now carries its own headless parameters beside the set it ships, and the update builds the other slot's
entries from THAT line, putting back only the keys that name this machine:

- os/v3/puppy/mkimage.sh:152: ONE variable builds the image's `linux` lines and the release's own line; :244 writes it
  to /1bit/cmdline on the set the data partition ships (not in SHA256SUMS - it is a line of text an update reads, not a
  bootable file it installs), so the image's grub.cfg and the file cannot disagree. A release directory made from that
  /1bit carries it too.
- 1bit-update:490 boot_param / :496 release_headless / :506 slot_params read it - bare parameters or a whole
  `linux <kernel> <params>` line, CRLF and #/blank lines included - and merge: the release's parameters as they are,
  with this machine's `pupsfs=UUID=`, `1bit.data=UUID=` and `psubdir=<target>` taken from the running entry, and
  `pfix=copy` -> `pfix=nocopy` for an installed disk, exactly the set 1bit-install.sh rewrites
  (os/v3/puppy/1bit-install.sh:206-211). A release that names a UUID pin the running line cannot fill in is refused by
  name: the image's own UUID would point the new slot at the release stick's partition.
- 1bit-update:836-912 writes the slot's headless AND serial entries from that line. An entry that already exists is
  rewritten in place and keeps its own kernel path; a missing one is appended, so a slot written by 1bit-install stops
  booting the installed release's parameters after an update and no entry accumulates. The image's desktop and
  install-to-disk entries are its own boot modes and are not touched. The written line is read back and compared with
  what this run wrote before `set default` moves (:912); a mismatch restores grub.cfg.
- A release cut before this (no /1bit/cmdline) is updated exactly as before, and the update warns that a parameter this
  release changed does not arrive.

Evidence (ryzen, configured Release tree; no device, no VM, no reboot):

1. CONTROL - origin/main's 1bit-update (sha256 9b38558c2da05e41...) with THIS branch's test file (new test, old code):

   $ git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > ~/.cache/scratch-3374/oldroot-3374/.../1bit-update
   $ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh <that script>
   ...
   FAIL the /1bit-alt boot line carries the NEW release's added parameter (printk.always_kmsg_dump=1; the installed line had none)
   FAIL the /1bit-alt serial root shell entry carries it too
   FAIL the update says where the /1bit-alt line came from
   FAIL GRUB's default is /1bit and its line carries the parameter release B CHANGED (log_buf_len=64M, not 32M)
   FAIL with this machine's UUID pin (not release B's) and release B's added parameter
   FAIL the /1bit serial entry got the changed value too
   FAIL the /1bit line is not the one 1bit-install wrote any more
   FAIL the update says it rewrote the existing entries
   control_rc=1, 26 ok / 8 FAIL
   the line the old script wrote: linux /1bit-alt/vmlinuz pmedia=atahd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt
     nvme.quirks=1e49:1081:dmapool_align_512 log_buf_len=32M     (no printk.always_kmsg_dump=1; release A's cmdline had it)

2. BRANCH - same test, same command, the tree's script:

   $ sudo env ONEBIT_E2E_TMP=~/.cache/scratch-3374/e2e sh tests/update_e2e_loop_test.sh
   /1bit-alt headless entry: linux /1bit-alt/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit-alt
     log_buf_len=32M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0
   /1bit headless entry: linux /1bit/vmlinuz pmedia=usbhd pupsfs=UUID=x 1bit.data=UUID=x psubdir=1bit
     log_buf_len=64M printk.always_kmsg_dump=1 pfix=nocopy,nox console=ttyS0,115200 console=tty0   (release B CHANGED 32M->64M)
   ok    the /1bit desktop entry keeps the installed line (1bit-update writes a slot's headless and serial entries only)
   ok    the existing entries were rewritten in place: still 6 menu entries, none duplicated
   fix_rc=0, 34 ok / 0 FAIL
   The fixture ESP is the image's real FOUR-entry menu (headless, desktop, install-to-disk, serial), so the serial line
   rewritten is entry 3 - not the entry next to the headless one - and the two modes 1bit-update does not own are
   asserted byte-identical to what 1bit-install left.

3. UNIT ROWS (tests/one_bit_update_slots_test.sh, sourced functions, no root):
   branch: 33 ok, exit 0.
   control (same rows, origin/main's script in a stub root): 23 ok / 10 FAIL, exit 1 - slot_params/release_headless do
   not exist there.

4. ctest, the two rows this change touches: 55 one_bit_update_slots Passed; 89 update_e2e_loop Passed (as root, with
   ONEBIT_E2E_TMP pointing inside ~/.cache so no scratch lands in /tmp or /var/tmp).

5. scripts/pre-pr-checks.sh --tree-only --base origin/main:
   pre-pr-checks: all 16 check(s) green, 2 skipped, 0 could not be told, 2 open-PR row(s) not run (--tree-only)
   (the 2 skips are hip_f16_audit and kernel_id_selftest: no gpu-kernels tree on this box.)

Refs #3374. The host-side criterion is met; one real update followed by a boot on an installed machine
(/proc/cmdline has the parameter, and the next boot files the pstore record) still needs hardware and a reboot, and was
not run here.
@github-actions

Copy link
Copy Markdown

PR-Agent command was not run

GitHub returned an incomplete or inconsistent changed-file set for this pull request, so PR-Agent stopped instead of analyzing only part of it.

GitHub limits changed-file responses to 3,000 files. If this pull request changes more than 3,000 files, split it into smaller pull requests and run the command again. Otherwise, retry the command.

@bong-water-water-bong
bong-water-water-bong enabled auto-merge (squash) November 24, 2026 07:56
@bong-water-water-bong
bong-water-water-bong merged commit 887ae3c into main Nov 24, 2026
10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the fix/3374-update-new-cmdline branch November 24, 2026 08:11
bong-water-water-bong pushed a commit that referenced this pull request Nov 24, 2026
…o, and draft the freeze RFC (engine#3448)

Security review (cl-flm lane, 24 Nov). Issue #3448 has two halves. The rollback half is fixed by #3454
(69bb03f): --latest reads the release identity from inside the verified image and refuses anything that
is not the tag asked for and strictly newer. The freeze half is open, and it is a release-trust decision
(CONTRIBUTING.md: anything touching security is an RFC), so this commit does NOT invent a fix for it: it
stops the tool from claiming the freshness it cannot prove, and puts the decision on record.

Rebased onto origin/main a95beca (after #3465/#3466/#3467); the line references below are that tree's.

The mechanism, as it stands (os/v3/puppy/embed/usr/local/bin/1bit-update):
- update_pick decides which release is the channel's newest and whether it is newer than the running one,
  from GitHub's release list (:257-302). That list is not signed; the first signature is checked at
  :453-455, after the "is it newer" decision, and the early exit says "up to date" without checking any
  signature (:430-438). So a release host that keeps serving the current release also keeps the machine
  answering "up to date" (freeze).

What changed:
- update_pick prints ahead=yes when the RUNNING release is newer than the channel's newest (a final against
  its own -rcs, or a channel that has not caught up), which used to be folded into newer=no (:291-295).
- update_check and update_latest answer that case "up to date: running X is newer than the CHANNEL's newest
  Y" and print one note that the answer is the unsigned release list's word, so a host that hides a newer
  release is not detectable (:328-336, :430-438). A plain "up to date" line is kept for the same-tag case,
  so the console, the notice and the board rows keep reading it.
- docs/update-trust.md (new): what the signature covers today (tools/release_sign.py), the exact order
  --latest decides in with file:line, what #3454 closed and what it leaves open, the freeze threat model
  (adversaries, in/out of scope, P1-P3), and the draft RFC body: options A (signed, expiring latest per
  channel reusing release_sign.py), B (TUF-style metadata), C (signed tag -> commit), D (tag+channel in the
  signed SHA256SUMS), E (accept the risk), each with its trust assumptions and cost, the test plan and the
  NOTICE impact, and the open owner questions.
- docs/os-v3.md, "In-system updates": a paragraph after the trust order saying what the order does not
  prove - freeze, with the release-list/commit/rollback facts - and pointing at the draft.
- tests/update_check_test.sh: two arms (the ahead wording, the note), and the existing "a final release
  sorts after its own release candidates" arm now asserts the ahead wording, which is what the tool says
  there now. os/mini/release-check.sh --self-test gains that same output as a PASS fixture, so the
  update-check row still recognises the answer on the board.

What remains open, and is the RFC's first question: is a compromised release host (freeze) in the threat
model? If yes, option A is the recommendation; if no, record that in docs/os-v3.md and close #3448. No code
in this commit closes it - the honest wording says exactly that.

Evidence:
- Control (new test, PRE-FIX updater from origin/main a95beca):
    c=~/.cache/scratch-3448/control; mkdir -p $c/tests $c/os/v3/puppy/embed/usr/local/bin
    git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > $c/os/v3/puppy/embed/usr/local/bin/1bit-update
    cp tests/update_check_test.sh $c/tests/
    (cd $c && sh tests/update_check_test.sh)
  FAIL a final release sorts after its own release candidates (v2026.49 > v2026.49-rc1)
  FAIL a running release newer than the channel's newest is said as ahead, not as a flat 'up to date'
  FAIL the up-to-date answer names the unsigned release list it rests on, and what that cannot detect
  update_check_test: FAIL
- Branch: sh tests/update_check_test.sh -> "update_check_test: ok" (12 arms).
- Sanity: the same control tree with origin/main's own test and updater -> "update_check_test: ok" (only the
  arms this change adds or re-words differ).
- ctest --test-dir build -R 'update|release_check_selftest|release_sign' --output-on-failure --timeout 600:
  "100% tests passed, 0 tests failed out of 12" (update_e2e_loop skipped: needs root/loop, unchanged).
- scripts/pre-pr-checks.sh --tree-only --base origin/main:
  "pre-pr-checks: all 15 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run
  (--tree-only)"; skips: submodule_pin (0 submodules initialised), hip_f16_audit and kernel_id_selftest
  (no gpu-kernels tree).

Refs #3448.
bong-water-water-bong added a commit that referenced this pull request Nov 24, 2026
…o, and draft the freeze RFC (engine#3448) (#3474)

Security review (cl-flm lane, 24 Nov). Issue #3448 has two halves. The rollback half is fixed by #3454
(69bb03f): --latest reads the release identity from inside the verified image and refuses anything that
is not the tag asked for and strictly newer. The freeze half is open, and it is a release-trust decision
(CONTRIBUTING.md: anything touching security is an RFC), so this commit does NOT invent a fix for it: it
stops the tool from claiming the freshness it cannot prove, and puts the decision on record.

Rebased onto origin/main a95beca (after #3465/#3466/#3467); the line references below are that tree's.

The mechanism, as it stands (os/v3/puppy/embed/usr/local/bin/1bit-update):
- update_pick decides which release is the channel's newest and whether it is newer than the running one,
  from GitHub's release list (:257-302). That list is not signed; the first signature is checked at
  :453-455, after the "is it newer" decision, and the early exit says "up to date" without checking any
  signature (:430-438). So a release host that keeps serving the current release also keeps the machine
  answering "up to date" (freeze).

What changed:
- update_pick prints ahead=yes when the RUNNING release is newer than the channel's newest (a final against
  its own -rcs, or a channel that has not caught up), which used to be folded into newer=no (:291-295).
- update_check and update_latest answer that case "up to date: running X is newer than the CHANNEL's newest
  Y" and print one note that the answer is the unsigned release list's word, so a host that hides a newer
  release is not detectable (:328-336, :430-438). A plain "up to date" line is kept for the same-tag case,
  so the console, the notice and the board rows keep reading it.
- docs/update-trust.md (new): what the signature covers today (tools/release_sign.py), the exact order
  --latest decides in with file:line, what #3454 closed and what it leaves open, the freeze threat model
  (adversaries, in/out of scope, P1-P3), and the draft RFC body: options A (signed, expiring latest per
  channel reusing release_sign.py), B (TUF-style metadata), C (signed tag -> commit), D (tag+channel in the
  signed SHA256SUMS), E (accept the risk), each with its trust assumptions and cost, the test plan and the
  NOTICE impact, and the open owner questions.
- docs/os-v3.md, "In-system updates": a paragraph after the trust order saying what the order does not
  prove - freeze, with the release-list/commit/rollback facts - and pointing at the draft.
- tests/update_check_test.sh: two arms (the ahead wording, the note), and the existing "a final release
  sorts after its own release candidates" arm now asserts the ahead wording, which is what the tool says
  there now. os/mini/release-check.sh --self-test gains that same output as a PASS fixture, so the
  update-check row still recognises the answer on the board.

What remains open, and is the RFC's first question: is a compromised release host (freeze) in the threat
model? If yes, option A is the recommendation; if no, record that in docs/os-v3.md and close #3448. No code
in this commit closes it - the honest wording says exactly that.

Evidence:
- Control (new test, PRE-FIX updater from origin/main a95beca):
    c=~/.cache/scratch-3448/control; mkdir -p $c/tests $c/os/v3/puppy/embed/usr/local/bin
    git show origin/main:os/v3/puppy/embed/usr/local/bin/1bit-update > $c/os/v3/puppy/embed/usr/local/bin/1bit-update
    cp tests/update_check_test.sh $c/tests/
    (cd $c && sh tests/update_check_test.sh)
  FAIL a final release sorts after its own release candidates (v2026.49 > v2026.49-rc1)
  FAIL a running release newer than the channel's newest is said as ahead, not as a flat 'up to date'
  FAIL the up-to-date answer names the unsigned release list it rests on, and what that cannot detect
  update_check_test: FAIL
- Branch: sh tests/update_check_test.sh -> "update_check_test: ok" (12 arms).
- Sanity: the same control tree with origin/main's own test and updater -> "update_check_test: ok" (only the
  arms this change adds or re-words differ).
- ctest --test-dir build -R 'update|release_check_selftest|release_sign' --output-on-failure --timeout 600:
  "100% tests passed, 0 tests failed out of 12" (update_e2e_loop skipped: needs root/loop, unchanged).
- scripts/pre-pr-checks.sh --tree-only --base origin/main:
  "pre-pr-checks: all 15 check(s) green, 3 skipped, 0 could not be told, 2 open-PR row(s) not run
  (--tree-only)"; skips: submodule_pin (0 submodules initialised), hip_f16_audit and kernel_id_selftest
  (no gpu-kernels tree).

Refs #3448.

Co-authored-by: bong-water-water-bong <[email protected]>
@github-actions

Copy link
Copy Markdown

Preparing review...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant