qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 8/9] bsd-user: implement sysctlbyname(2)


From: Kyle Evans
Subject: Re: [PATCH 8/9] bsd-user: implement sysctlbyname(2)
Date: Sat, 11 Feb 2023 22:23:42 -0600

On Sat, Feb 11, 2023 at 5:13 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 2/10/23 13:18, Warner Losh wrote:
> > From: Kyle Evans <kevans@FreeBSD.org>
> >
> > 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 <kevans@FreeBSD.org>
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> >   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~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]