tech-kern archive

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

Re: sysctl_createv: sysctl_create(no_sa_support) returned 22

On 22.07.2011 21:30, Peter Tworek wrote:
> Hi,


> Some time ago I've noticed that my current kernel prints this message
> when booting. As far as I understand no_sa_support syscall is only
> required for NetBSD 4.0 binary compatibility, which I've disabled. I've
> made a small patch which takes care of this message by putting
> sysctl_createv call in COMPAT_40 ifdefs? Can this patch be included in
> current sources?

IMHO, the EINVAL (22) is due to KERN_SA being undefined. The sysctl(7)
value is always hardcoded to 1 here but without the CTLFLAG_IMMEDIATE
flag set (and without any pointer to a valid storage address); this
looks rather invalid to me.

Could you give a try to the attached patch instead, please? I made the
KERN_SA macro reverse so the thing looks more evident.

As a side note: we try to avoid putting COMPAT_* macros everywhere in
kernel code and prefer to keep these in a small number of files; this
simplifies modularity as it avoids a complete kernel recompilation to
add/remove support for compat modules.

Thanks for reporting!

Jean-Yves Migeon
Index: sys/kern/init_sysctl.c
RCS file: /cvsroot/src/sys/kern/init_sysctl.c,v
retrieving revision 1.181
diff -u -p -r1.181 init_sysctl.c
--- sys/kern/init_sysctl.c      24 May 2011 16:39:56 -0000      1.181
+++ sys/kern/init_sysctl.c      22 Jul 2011 23:46:27 -0000
@@ -735,15 +735,18 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl 
                       CTL_CREATE, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
+#ifndef KERN_SA
+                      CTLFLAG_IMMEDIATE|
                       CTLTYPE_INT, "no_sa_support",
                       SYSCTL_DESCR("0 if the kernel supports SA, otherwise "
                       "it doesn't"),
-#ifdef KERN_SA
-                      0, &sa_system_disabled,
+#ifndef KERN_SA
                       1, NULL,
+                      0, &sa_system_disabled,
                       CTL_KERN, CTL_CREATE, CTL_EOL);

Home | Main Index | Thread Index | Old Index