Hi David, all,
Last week I opened four pull requests on Codeberg with fixes for
issues found with SVACE and then checked by hand. They're small and
independent of each other, and I'd appreciate a review when you have
time.
Two of them affect code that is built in master:
#22 sanlock: fix stack overflow in client status
https://codeberg.org/sanlock/sanlock/pulls/22
recv_bin() trusts num_disks from the daemon's reply, and
"sanlock client status" reads into a 4096-byte buffer on the
stack. A resource with SANLK_MAX_DISKS (4) disks needs 4288
bytes, so the default unsorted output overflows the stack by
192 bytes.
#20 sanlock: don't follow symlinks when opening the lockfile
https://codeberg.org/sanlock/sanlock/pulls/20
The daemon opens /run/sanlock/sanlock.pid while still root, in a
directory owned by the sanlock user, without O_NOFOLLOW, then
truncates it and writes the pid. Anything running as sanlock can
replace it with a symlink, and on the next start root clobbers
the target.
The other two are in the rindex code. It's disabled in master since
c5b925c, but released versions still ship it:
#19 sanlock: validate sizes in rindex header
https://codeberg.org/sanlock/sanlock/pulls/19
The align flags and sector_size from the on-disk header are used
as divisors without any check, so a header without an align flag
kills the daemon with SIGFPE on lookup or update.
#21 sanlock: fix resource offset overflow in rindex search
https://codeberg.org/sanlock/sanlock/pulls/21
i * align_size in search_entries() overflows int starting at
entry 2048 with 1M alignment, and the resulting offset can land
on the rindex's own paxos lease.
Each PR description has the details.
Thanks,
Mikhail