Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle overwriting tags in syslinux ADV
This is (still) being used in Talos to handle upgrade rollbacks. There were multiple problems with this code, and one of them leads to panic if the tag is written multiple times without deletion: ``` github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/syslinux.ADV.SetTagBytes({0xc00175bc00?, 0x1f11dbe?, 0xed4f4d?}, 0x0?, {0xc000afb7f0?, 0x400?, 0x0?}) /src/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/syslinux/syslinux.go:125 +0x270 github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/syslinux.ADV.SetTag(...) /src/internal/app/machined/pkg/runtime/v1alpha1/bootloader/adv/syslinux/syslinux.go:95 github.com/siderolabs/talos/cmd/installer/pkg/install.(*Installer).Install(0xc0004374a0, 0x5) /src/cmd/installer/pkg/install/install.go ``` The `uint8()` conversion was causing overflow and wrong index when ADV real length is over 255. Fix multiple writes of the same tag by deleting previous value first. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
- Loading branch information