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: Richard Henderson
Subject: Re: [PATCH 8/9] bsd-user: implement sysctlbyname(2)
Date: Sat, 11 Feb 2023 13:13:46 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

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?

+    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]