Bug 215061

Summary: COMPAT_LINUX32 in kernel with linux_enable causes undefined symbol on boot
Product: Base System Reporter: Jack <xxjack12xx>
Component: kernAssignee: freebsd-emulation (Nobody) <emulation>
Status: New ---    
Severity: Affects Many People CC: asmodai, avos, xxjack12xx
Priority: ---    
Version: 11.0-RELEASE   
Hardware: amd64   
OS: Any   
Bug Depends on:    
Bug Blocks: 247219    

Description Jack 2016-12-05 04:30:16 UTC
When
options         COMPAT_LINUX32
is defined in the kernel and
linux_enable="YES"
in rc.conf, the system boots with this error:

link_elf_obj: symbol elf64_linux_vdso_fixup undefined
linker_load_file: Unsupported file type


When
options         COMPAT_LINUX32
is not defined in the kernel and linux_enable="YES" in rc.conf, the linux module loads fine.

Linux x86-64 ELF exec handler installed
Comment 1 Jeroen Ruigrok van der Werven freebsd_committer 2017-06-01 06:02:59 UTC
Actually, on 11-STABLE and not having any mention of COMPAT_LINUX or COMPAT_LINUX32 in my kernel, trying to kldload linux64.ko I still get this message in the logs:

% sudo kldload linux64
kldload: an error occurred while loading the module. Please check dmesg(8) for more details.
% dmesg | tail -2
link_elf_obj: symbol elf64_linux_vdso_fixup undefined
linker_load_file: Unsupported file type
% grep LINUX /usr/src/sys/amd64/conf/DEALER 
#options 	COMPAT_LINUX
Comment 2 Jeroen Ruigrok van der Werven freebsd_committer 2017-06-01 06:15:25 UTC
Rephrase my previous comment, looks like the kernel I was using had COMPAT_LINUX32 compiled in.

Rebuilding with the file shown from the grep allows one to kldload either linux.ko or linux64.ko successfully.

I'll check the documentation and see what can be adjusted there to save people from annoyance.
Comment 3 Jeroen Ruigrok van der Werven freebsd_committer 2017-06-01 06:16:12 UTC
For the record:

% uname -a
FreeBSD dealer 11.1-PRERELEASE FreeBSD 11.1-PRERELEASE #7 r319368M: Thu Jun  1 08:01:01 CEST 2017     root@dealer:/usr/obj/usr/src/sys/DEALER  amd64

% kldstat | grep  lin
 5    1 0xffffffff8261f000 a887     linprocfs.ko
 6    2 0xffffffff8262a000 7afc     linux_common.ko
 7    1 0xffffffff82632000 3c7ff    linux64.ko
Comment 4 commit-hook freebsd_committer 2021-06-21 16:57:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e013e36939ac87b53195370fb5e29f29c1a4b5c6

commit e013e36939ac87b53195370fb5e29f29c1a4b5c6
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-06-22 05:32:39 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2021-06-22 05:32:39 +0000

    linux(4): Get rid of Linuxulator kernel build options.

    Stop confusing people, retire COMPAT_LINUX and COMPAT_LINUX32 kernel
    build options. Since we have 32 and 64 bit Linux emulators, we can't build both
    emulators together into the kernel. I don't think it matters, Linux emulation
    depends on loadable modules (via rc).

    Cut LINPROCFS and LINSYSFS for consistency.

    PR:                     215061
    Reviewed by:            bcr (manpages), trasz
    Differential Revision:  https://reviews.freebsd.org/D30751
    MFC after:              2 weeks

 share/man/man4/aac.4     |  4 +---
 share/man/man4/aacraid.4 |  4 +---
 share/man/man4/linux.4   | 15 +-----------
 share/man/man4/tdfx.4    | 13 ++++++----
 sys/amd64/conf/NOTES     | 17 -------------
 sys/conf/NOTES           |  4 ++--
 sys/conf/files           |  5 ----
 sys/conf/files.amd64     | 62 ------------------------------------------------
 sys/conf/files.i386      | 58 --------------------------------------------
 sys/conf/files.x86       |  1 -
 sys/conf/options.amd64   |  2 +-
 sys/i386/conf/NOTES      | 16 +------------
 12 files changed, 16 insertions(+), 185 deletions(-)