Page MenuHomeFreeBSD

fspacectl: remove unneeded freebsd32 wrapper
ClosedPublic

Authored by brooks on Nov 15 2021, 6:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 17, 5:01 AM
Unknown Object (File)
Wed, Sep 11, 3:08 AM
Unknown Object (File)
Tue, Sep 10, 3:48 PM
Unknown Object (File)
Thu, Sep 5, 8:15 AM
Unknown Object (File)
Wed, Sep 4, 10:18 AM
Unknown Object (File)
Sun, Sep 1, 5:07 AM
Unknown Object (File)
Wed, Aug 28, 10:40 PM
Unknown Object (File)
Aug 11 2024, 9:21 AM
Subscribers

Details

Summary

fspacectl(2) does not require special handling on freebsd32. The
presence of off_t in a struct does not cause it's size to change
between the native ABI and the 32-bit ABI supported by freebsd32
because off_t is always int64_t on BSD systems. Situations requiring
special handling may arise for i386 if and off_t is proceeded by an
8-byte aligned int, but that situation does not appaly. Further, byte
order only requires handling for paired argument or return registers.

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.Nov 15 2021, 6:27 PM

Well, this makes kern_fspacectl() useless and not providing the expectation for kern_* that arguments are already in the KVA, isn't it?

@khng points out that rqsr won't ever be NULL in kern_fspacectl. I was misled by the if (rqsr == NULL) that should have been a KASSERT (or nonexistent). I'll update the review shortly.

In D32994#745048, @kib wrote:

Well, this makes kern_fspacectl() useless and not providing the expectation for kern_* that arguments are already in the KVA, isn't it?

I'd prefer to keep kern_fspacectl() as I need it in CheriBSD. I will make it static so it will have zero cost in practice.

In D32994#745048, @kib wrote:

Well, this makes kern_fspacectl() useless and not providing the expectation for kern_* that arguments are already in the KVA, isn't it?

I'd prefer to keep kern_fspacectl() as I need it in CheriBSD. I will make it static so it will have zero cost in practice.

I mean keep kern_, but do copyin/out in sys_.

In D32994#745067, @kib wrote:
In D32994#745048, @kib wrote:

Well, this makes kern_fspacectl() useless and not providing the expectation for kern_* that arguments are already in the KVA, isn't it?

I'd prefer to keep kern_fspacectl() as I need it in CheriBSD. I will make it static so it will have zero cost in practice.

I mean keep kern_, but do copyin/out in sys_.

I don't think that's an expectation of kern_ functions. It's sometimes the desired interface to allow thunking (e.g. for linux or freebsd32), but it's not a consistent requirement.

In this case I'm not convinced we should be copying out unless we've called fo_fspacectl, but I could well be wrong there.

Given that I was wrong about the stack leak, I'd be fine dropping the diff to sys_generic.c entirely and leaving that part alone.

I don't think that's an expectation of kern_ functions. It's sometimes the desired interface to allow thunking (e.g. for linux or freebsd32), but it's not a consistent requirement.

It is actually my plan to implement Linuxulator's fallocate(2) with a call to fspacectl as well.

  • Only remove freebsd32 bits
This revision now requires review to proceed.Nov 15 2021, 11:59 PM
This revision is now accepted and ready to land.Nov 16 2021, 12:16 AM

Situations requiring
special handling may arise for i386 if and off_t is proceeded by an
8-byte aligned int, but that situation does not appaly.

I was a bit confused at first by this statement - I think it is probably worth including, but maybe make it stand apart from the main part of the message or make it explicitly parenthetical or so?

Fixes: 0dc332bff200c

This revision was automatically updated to reflect the committed changes.