NetBSD-Bugs archive

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

kern/51598: compat code gets pulled into non-compat kernels



>Number:         51598
>Category:       kern
>Synopsis:       (networking) compat code is pulled into non-compat kernels
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 03 22:15:00 +0000 2016
>Originator:     Paul Goyette
>Release:        NetBSD 7.99.36
>Organization:
+------------------+--------------------------+------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:      |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+------------------------+
>Environment:
	
	
System: NetBSD speedy.whooppee.com 7.99.36 NetBSD 7.99.36 (SPEEDY 2016-09-09 11:36:24) #0: Fri Sep 9 20:18:34 PHT 2016 paul%speedy.whooppee.com@localhost:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
The functions compat_cvtcmd() and compat_ifioctl() are defined in source
file sys/compat/common/if_43.c and included in the libcompat library.  In
sys/net/if.c there are calls to each of these routines which do not depend
on any version-specific COMPAT_xx option.  Indeed, these calls are
conditional only on OIFREQ, which appears to be unconditionally #define in
sys/sys/socket.h.

As a result, the compat code gets pulled into all kernels by the linker (so
it can resolve the symbol references).  Thus it is not possible to include
if_43.c in the spearately-loaded compat module (which is where it most
likely belongs), since loading such a module would result in redefinition
of the routines.
	
>How-To-Repeat:
Move if_43.c out of sys/compat/common/Makefile and into Makefile/sysio, and
build a modular kernel, removing all occurrences of COMPAT_[0-9][0-9] from
the configuration file.  Boot, and try to 'modload compat'
	
>Fix:
Ideally, these two functions would be invoked by indirect pointers rather
than direct function call.  Then, the default kernel builds could provide
no-op stubs in if.c, and the compat_modcmd(MODULE_CMD_INIT, ...) code
could replace the pointers to reference the if_43 replacements.  (Of course,
the MODULE_CMD_FINI code should restore the original values when the module
is unloaded.)
	

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index