Page MenuHomeFreeBSD

linprocfs: Properly reset error variable for mtab generation
ClosedPublic

Authored by michaelo on Dec 2 2024, 1:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 6, 2:27 PM
Unknown Object (File)
Mon, Jan 6, 2:15 PM
Unknown Object (File)
Mon, Jan 6, 11:27 AM
Unknown Object (File)
Mon, Jan 6, 12:54 AM
Unknown Object (File)
Dec 19 2024, 6:44 AM
Unknown Object (File)
Dec 17 2024, 9:00 AM
Unknown Object (File)
Dec 6 2024, 2:33 PM
Unknown Object (File)
Dec 4 2024, 10:57 PM
Subscribers
None

Details

Summary

Both functions linprocfs_domtab() and linprocfs_doprocmountinfo() are
logically identical, but the former fails with ECANCELED because error
is not reset after the for loop.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

michaelo created this revision.

Please add others you think see fit.

In a jail first before patch, then after patch:

root@deblndw013x1j:/compat/linux/proc
# cat mounts
cat: mounts: Operation canceled

root@deblndw013x1j:/compat/linux/proc
# cat mounts
hp-large/bastille/jails/deblndw013x1j/root / zfs rw,noatime 0 0
devfs /dev devfs rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
fdescfs /dev/fd fdescfs rw 0 0
proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
devfs /dev devfs rw 0 0
fdescfs /dev/fd fdescfs rw 0 0

Another jail on another host:

root@deblndw011x1j:/compat/linux/proc
# cat mounts
cat: mounts: Operation canceled

Jailhost before patch:

root@deblndw013x:/compat/linux/proc/self
# cat mounts
cat: mounts: Operation canceled

Jailhost after patch:

root@deblndw013x:/compat/linux/proc/self
# cat mounts
zroot/ROOT/default / zfs rw,noatime 0 0
devfs /dev devfs rw 0 0
fdescfs /dev/fd fdescfs rw 0 0
hp-large/osipovmi /var/osipovmi zfs rw,noatime 0 0
zroot/var/mail /var/mail zfs rw 0 0
zroot/usr/src /usr/src zfs rw,noatime 0 0
zroot/compat /compat zfs rw,noatime 0 0
zroot/var/crash /var/crash zfs rw,noexec,nosuid,noatime 0 0
zroot/usr/local /usr/local zfs rw,noatime 0 0
zroot/usr/home /usr/home zfs rw,noatime 0 0
zroot/var/audit /var/audit zfs rw,noexec,nosuid,noatime 0 0
zroot /zroot zfs rw,noatime 0 0
zroot/var/tmp /var/tmp zfs rw,nosuid,noatime 0 0
zroot/var/log /var/log zfs rw,noexec,nosuid,noatime 0 0
hp-large/bhyve /usr/local/bhyve zfs rw,noatime 0 0
zroot/tmp /tmp zfs rw,nosuid,noatime 0 0
hp-large/bastille /usr/local/bastille zfs rw,noatime 0 0
zroot/usr/ports /usr/ports zfs rw,nosuid,noatime 0 0
zroot/usr/obj /usr/obj zfs rw,noatime 0 0
hp-large/bastille/logs /var/log/bastille zfs rw,noatime 0 0
hp-large/bastille/backups /usr/local/bastille/backups zfs rw,noatime 0 0
hp-large/bastille/cache /usr/local/bastille/cache zfs rw,noatime 0 0
hp-large/bastille/templates /usr/local/bastille/templates zfs rw,noatime 0 0
hp-large/bastille/jails /usr/local/bastille/jails zfs rw,noatime 0 0
hp-large/bastille/releases /usr/local/bastille/releases zfs rw,noatime 0 0
hp-large/bastille/cache/13.3-RELEASE /usr/local/bastille/cache/13.3-RELEASE zfs rw,noatime 0 0
hp-large/bastille/cache/13.4-RELEASE /usr/local/bastille/cache/13.4-RELEASE zfs rw,noatime 0 0
hp-large/bastille/releases/13.4-RELEASE /usr/local/bastille/releases/13.4-RELEASE zfs rw,noatime 0 0
hp-large/bastille/jails/deblndw013x2j /usr/local/bastille/jails/deblndw013x2j zfs rw,noatime 0 0
hp-large/bastille/releases/13.3-RELEASE /usr/local/bastille/releases/13.3-RELEASE zfs rw,noatime 0 0
hp-large/bastille/jails/deblndw013x2j/root /usr/local/bastille/jails/deblndw013x2j/root zfs rw,noatime 0 0
hp-large/bastille/jails/deblndw013x1j /usr/local/bastille/jails/deblndw013x1j zfs rw,noatime 0 0
hp-large/bastille/jails/deblndw013x1j/root /usr/local/bastille/jails/deblndw013x1j/root zfs rw,noatime 0 0
proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
devfs /dev devfs rw 0 0
fdescfs /dev/fd fdescfs rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
-hosts /net autofs rw 0 0
automounts /net autofs rw 0 0
devfs /usr/local/bastille/jails/deblndw013x1j/root/compat/linux/dev devfs rw 0 0
tmpfs /usr/local/bastille/jails/deblndw013x1j/root/compat/linux/dev/shm tmpfs rw 0 0
fdescfs /usr/local/bastille/jails/deblndw013x1j/root/compat/linux/dev/fd fdescfs rw 0 0
proc /usr/local/bastille/jails/deblndw013x1j/root/compat/linux/proc proc rw 0 0
/sys /usr/local/bastille/jails/deblndw013x1j/root/compat/linux/sys sysfs rw 0 0
devfs /usr/local/bastille/jails/deblndw013x1j/root/dev devfs rw 0 0
fdescfs /usr/local/bastille/jails/deblndw013x1j/root/dev/fd fdescfs rw 0 0
devfs /usr/local/bastille/jails/deblndw013x2j/root/dev devfs rw 0 0
fdescfs /usr/local/bastille/jails/deblndw013x2j/root/dev/fd fdescfs rw 0 0
This revision is now accepted and ready to land.Dec 10 2024, 8:46 PM

Is @fluffy's review enough to merge this? Does @fluffy have src commit bit?

Your change seems simple enough. If you're confident, go for it. If you want review from a src committer, you'll have to pester someone.

In D47865#1096992, @jrm wrote:

Your change seems simple enough. If you're confident, go for it. If you want review from a src committer, you'll have to pester someone.

Quite, yes. Since now it always fails for me on both UFS and ZFS. Will then push.