On 2/10/23 13:18, Warner Losh wrote:
From: Kyle Evans <kev...@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 <kev...@freebsd.org>
Signed-off-by: Warner Losh <i...@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