Page MenuHomeFreeBSD

linprocfs_domtab() rewrite
ClosedPublic

Authored by trasz on Apr 1 2015, 8:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 3:52 PM
Unknown Object (File)
Tue, Dec 17, 6:31 AM
Unknown Object (File)
Wed, Dec 11, 2:35 AM
Unknown Object (File)
Sat, Nov 30, 8:48 AM
Unknown Object (File)
Wed, Nov 27, 7:17 AM
Unknown Object (File)
Nov 17 2024, 9:42 AM
Unknown Object (File)
Nov 12 2024, 6:01 PM
Unknown Object (File)
Nov 7 2024, 1:31 AM
Subscribers

Details

Summary

Rewrite linprocfs_domtab() as a wrapper around kern_getfsstat(). This
adds missing jail and MAC checks.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

trasz retitled this revision from to linprocfs_domtab() rewrite.
trasz updated this object.
trasz edited the test plan for this revision. (Show Details)

This is most likely a good change.

sys/compat/linprocfs/linprocfs.c
335 ↗(On Diff #4562)

Do not initialize in definition.

It is probably safer to initialize the buf to NULL (not required, but it made me wonder for a moment).

342 ↗(On Diff #4562)

I see that this is not changed, but why is error from namei() ignored ?

It seems reasonable to change the kern_getfsstat() to return the count explicitely, instead of relying on td_retval. I think it was only used by compat32 so far, but new use is ugly without the proper handling of count.

trasz edited edge metadata.

Tidy up.

I think the error is ignored to account for possibility that the path doesn't exist. I'd prefer not to touch it for now, this code is a little scary.

As for returning the count from kern_getfsstat() - good point, but I'd rather leave this for later.

So, does it look ok now? If so, can you mark it Accepted? Thanks!

I do not like td_retval thing, it is too hackish. IMO this is exactly the right moment to fix it.

I agree that handling namei error (or commenting why error could be ignored) is for the other moment.

Hm, okay. How to return the count, then? Reuse the 'count' argument, or add a new one? Is there a convention that says which argument should it be? The last?

In D2193#13, @trasz wrote:

Hm, okay. How to return the count, then? Reuse the 'count' argument, or add a new one? Is there a convention that says which argument should it be? The last?

Up to you and a common sense. I would add the last argument like int *count (exact type might need some correction).

Make kern_getfsstat() return count explicitly.

Yes, this is the intended change, but it seems that you missed compat/freebsd32.

sys/compat/freebsd32/freebsd32_misc.c
258 ↗(On Diff #4813)

Move the assignment after we ensured that all copyout()s succeeded.

sys/kern/vfs_syscalls.c
442 ↗(On Diff #4813)

Do not assign to td_retval if error != 0.

sys/kern/vfs_syscalls.c
635 ↗(On Diff #4815)

There too ?

Add one more missing error check.

kib edited edge metadata.
This revision is now accepted and ready to land.Apr 14 2015, 12:28 PM
trasz updated this revision to Diff 4833.

Closed by commit rS281551 (authored by @trasz).