runtime: tolerate vendor suffixes in Linux kernel release strings#170
Conversation
creachadair
left a comment
There was a problem hiding this comment.
Just one non-blocking nit.
| // elided. | ||
| func parseRelease(rel string) (major, minor, patch int, ok bool) { | ||
| // Strip anything after a dash or plus. | ||
| // Strip anything after a dash, plus, or underscore. Some |
There was a problem hiding this comment.
The change seems fine, but we no longer actually follow semver grammar, strictly speaking (to be fair, Synology et al. started it). Maybe note this in the doc comment above? E.g.,
// parseRelease parses a dot-separated version number.
// It follows semver syntax, but allows the minor and patch
// versions to be elided, and accepts "_" as a separator for
// pre-release labels in addition to "-".or words to that effect.
(Likewise we don't handle build labels either, though if we got one of those on a kernel release we probably have bigger issues 😅)
There was a problem hiding this comment.
Strictly speaking, this code from Go (which is like 10 years old) never did semver... it also parse "4.5" without a patch.
There was a problem hiding this comment.
Yeah, I don't think we need to match the spec, my comment was mostly just about updating the comment. But it's unexported, so certainly not essential.
ca0927e to
f8637b7
Compare
… strings Synology kernels can have a "_" in their uname version. Make the parsing more tolerant. And also don't throw during init if we fail to parse the kernel version. Instead, fall back to probing. (We can't probe all the time, because seccomp filters on some platforms like Android kill the process if we call a verbotenen system call) This regressed in CL 758902 (forked from CL 751340) on 2026-03-24, which started calling parseRelease unconditionally during osinit on 32-bit Linux. Updates golang#79612 Updates #162 Updates tailscale/tailscale#6860 Change-Id: I98f61b94e54c7b9d08029f3aef664bdda9ec7f69 (cherry picked from commit dc6ef1e053c22ff9736f944e737bfc8015bd30ab patchset 4 of https://go-review.googlesource.com/c/go/+/781800)
f8637b7 to
7104161
Compare
Synology kernels can have a "_" in their uname version. Make the
parsing more tolerant. And also don't throw during init if we fail to
parse the kernel version. Instead, fall back to probing. (We can't
probe all the time, because seccomp filters on some platforms like
Android kill the process if we call a verbotenen system call)
This regressed in CL 758902 (forked from CL 751340) on 2026-03-24,
which started calling parseRelease unconditionally during osinit on
32-bit Linux.
Updates golang#79612
Updates #162
Updates tailscale/tailscale#6860
Change-Id: I98f61b94e54c7b9d08029f3aef664bdda9ec7f69
(cherry picked from commit dc6ef1e053c22ff9736f944e737bfc8015bd30ab
patchset 4 of https://go-review.googlesource.com/c/go/+/781800)