Page MenuHomeFreeBSD

Add linux_to_bsd_errtbl[]
ClosedPublic

Authored by trasz on Oct 27 2020, 3:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 11 2024, 12:09 AM
Unknown Object (File)
Jan 11 2024, 12:09 AM
Unknown Object (File)
Jan 11 2024, 12:09 AM
Unknown Object (File)
Jan 11 2024, 12:05 AM
Unknown Object (File)
Dec 20 2023, 3:29 AM
Unknown Object (File)
Dec 13 2023, 5:15 AM
Unknown Object (File)
Nov 29 2023, 9:22 AM
Unknown Object (File)
Nov 28 2023, 9:29 PM

Details

Summary

Add linux_to_bsd_errtbl[], mapping Linux errnos to their BSD counterparts. This will be used by fuse(4).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

trasz requested review of this revision.Oct 27 2020, 3:53 PM
asomers requested changes to this revision.Oct 31 2020, 3:15 PM
asomers added a subscriber: asomers.
asomers added inline comments.
sys/compat/linux/linux_errno.c
28 ↗(On Diff #78959)

You shouldn't assert here. If so, you'll give a buggy (or even malicious) FUSE daemon the power to crash the kernel.

sys/compat/linux/linux_errno.h
183 ↗(On Diff #78959)

You should wrap this line with #ifdef KERNEL. Otherwise, userspace programs may end up depending on this symbol, even though it's not guaranteed to be stable across different kernel versions.

This revision now requires changes to proceed.Oct 31 2020, 3:15 PM
sys/compat/linux/linux_errno.c
28 ↗(On Diff #78959)

Perhaps EDOOFUS

xtouqh_icloud.com added inline comments.
sys/compat/linux/linux_errno.c
40 ↗(On Diff #78959)

Noticed same issue in D26959, but commenting on already committed code so it could be fixed if my observation is correct.

Using sizeof() this way here looks bogus, shouldn't it be either sizeof(array)/sizeof(array[0]) or simply nitems(array)?

45 ↗(On Diff #78959)

Same sizeof() issue.

hselasky added inline comments.
sys/compat/linux/linux_errno.c
28 ↗(On Diff #78959)

Just pass errors that are outside the range AS-IS.

trasz marked 3 inline comments as done.

Fix multiple issues.

sys/compat/linux/linux_errno.c
28 ↗(On Diff #78959)

This function has no consumers at this point, so I'll just remove it - it's kind of pointless to guess what the semantics should be. The table is necessary for fuse(4), but it includes linux_errno.inc directly, to avoid dependency on linux KLD.

40 ↗(On Diff #78959)

D'oh! Thanks for reporting it.

sys/compat/linux/linux_errno.c
18 ↗(On Diff #79129)

Should this code bet written like this?

if (error >= 0 && error <= ELAST)
  return (linux_errtbl[error]);
else
  return (XXX);
sys/compat/linux/linux_errno.c
18 ↗(On Diff #79129)

Not really; this is for errors generated by the kernel, so we trust the error is correct.

trasz retitled this revision from Add linux_to_bsd_errno() to Add linux_to_bsd_errtbl[].Nov 4 2020, 12:56 PM
trasz edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Nov 4 2020, 2:06 PM