kern/145024: [linux] kernel crash by linux.ko module with
nooptions COMPAT_FREEBSD32
Alexander Best
arundel at freebsd.org
Sun Jan 30 22:09:33 UTC 2011
On Sun Jan 30 11, Alexander Best wrote:
> On Sun Jan 30 11, Chagin Dmitry wrote:
> > On Sun, Jan 30, 2011 at 06:59:24PM +0000, Alexander Best wrote:
> > > On Sun Jan 30 11, Chagin Dmitry wrote:
> > > > On Sun, Jan 30, 2011 at 06:27:53PM +0000, arundel at freebsd.org wrote:
> > > > > Old Synopsis: [linux] [panic] kernel crash by linux.ko module with nooptions COMPAT_FREEBSD32
> > > > > New Synopsis: [linux] kernel crash by linux.ko module with nooptions COMPAT_FREEBSD32
> > > > >
> > > > > State-Changed-From-To: open->analyzed
> > > > > State-Changed-By: arundel
> > > > > State-Changed-When: Sun Jan 30 18:13:13 UTC 2011
> > > > > State-Changed-Why:
> > > > > We have two possibilities in order to fix this issue:
> > > > >
> > > > > 1) Add something like the following somewhere in sys/amd/linux32:
> > > > >
> > > > > #ifndef COMPAT_FREEBSD32
> > > > > #error "linux emulation requires COMPAT_FREEBSD32 \
> > > > > option for non 32 bit architectures"
> > > > > #endif
> > > > >
> > > > > 2) Find a way to avoid the freebsd32_exec_copyin_args() call in
> > > > > linux32_machdep.c. I believe this is the only place in the sys/amd/linux32
> > > > > code that depends on sys/amd64/ia32 code.
> > > > >
> > > > > NB: I've removed the panic tag from this PR. I was able to reproduce the issue,
> > > > > however a panic didn't occur. The problem is that
> > > > > freebsd32_exec_copyin_args() wasn't compiled into the kernel and loading the
> > > > > linux kernel module thus fails.
> > > > >
> > > >
> > > > hi, close report, see r205014.
> > >
> > > i verified the issue with a recent HEAD just a few minutes ago. the point is
> > > that users should be informed, when they build the linuxulator on 64 bit
> > > architectures without the COMPAT_FREEBSD32, because that will give them a
> > > broken linuxulator. either that or remove the freebsd32_exec_copyin_args() call
> > > from the linuxulator to make it independent from COMPAT_FREEBSD32 code.
> > >
> >
> > ah, i see.. module Makefile. so, we should sync kernel and module build
> > options.
>
> i've tried adding linux compatibility to the kernel and even without the
> COMPAT_FREEBSD32 option, the linuxulator works.
sorry i did a mistake. in fact:
*with* COMPAT_LINUX32 in the kernel conf and *no* COMPAT_FREEBSD32, target
buildkernel fails:
/usr/subversion-src/sys/amd64/linux32/linux32_sysvec.c:38:2: error: #error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!"
#error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!"
...which is what should also happen when the linux kernel module gets compiled
and there's *no* COMPAT_FREEBSD32 in the kernel conf.
i think the following patch should fix this issue:
Index: sys/modules/linux/Makefile
===================================================================
--- sys/modules/linux/Makefile (revision 218104)
+++ sys/modules/linux/Makefile (working copy)
@@ -2,7 +2,7 @@
.if ${MACHINE_CPUARCH} == "amd64"
SFX= 32
-CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32
+CFLAGS+=-DCOMPAT_LINUX32
.endif
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX}
cheers.
alex
>
> so the problem is only with the module. i suspect the problem to be here:
>
> FLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32
> ^^
> the -DCOMPAT_FREEBSD32 doesn't do anything. since the module gets built after
> the kernel and the kernel doesn't come with ia32 emulation code, that option
> doesn't trigger anything.
>
> we need to somehow determine if the user wants to build the linuxulator module
> before building the modules and force ia32 emulation accordingly. having the
> ia32 code available as module too, would make things a lot easier.
>
> cheers.
> alex
>
> >
> >
> > --
> > Have fun!
> > chd
>
>
>
> --
> a13x
--
a13x
More information about the freebsd-emulation
mailing list