On Sat, Feb 11, 2023 at 5:13 PM Richard Henderson
<[email protected]> wrote:
>
> On 2/10/23 13:18, Warner Losh wrote:
> > From: Kyle Evans <[email protected]>
> >
> > do_freebsd_sysctlbyname needs to translate the 'name' back down to a OID
> > so we can intercept the special ones. Do that and call the common wrapper
> > do_freebsd_sysctl_oid.
> >
> > Signed-off-by: Kyle Evans <[email protected]>
> > Signed-off-by: Warner Losh <[email protected]>
> > ---
> > bsd-user/freebsd/os-sys.c | 58 +++++++++++++++++++++++++++++++++++
> > bsd-user/freebsd/os-syscall.c | 4 +++
> > 2 files changed, 62 insertions(+)
> >
> > diff --git a/bsd-user/freebsd/os-sys.c b/bsd-user/freebsd/os-sys.c
> > index 13736936e5f..62c729dfe47 100644
> > --- a/bsd-user/freebsd/os-sys.c
> > +++ b/bsd-user/freebsd/os-sys.c
> > @@ -345,6 +345,64 @@ out:
> > return ret;
> > }
> >
> > +/*
> > + * This syscall was created to make sysctlbyname(3) more efficient.
> > + * Unfortunately, because we have to fake some sysctls, we can't do that.
>
> Can't do what? Directly use sysctlbyname?
>
How about:
/*
* This syscall was created to make sysctlbyname(3) more efficient, but
* we can't really provide it in bsd-user. Notably, we must always translate
* the names independently since some sysctl values have to be faked
* for the target environment, so it still has to break down to two syscalls
* for the underlying implementation.
*/
> > + if (oldlenp) {
> > + if (get_user_ual(oldlen, oldlenp)) {
> > + return -TARGET_EFAULT;
> > + }
>
> Same comment about verifying write early.
>
> > + unlock_user(holdp, oldp, holdlen);
>
> And writeback vs error.
>
>
> r~