From owner-freebsd-current@freebsd.org Mon Apr 9 19:52:43 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 627BFF9E27B for ; Mon, 9 Apr 2018 19:52:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FC5F6EB7B; Mon, 9 Apr 2018 19:52:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 330D710AFD4; Mon, 9 Apr 2018 15:52:42 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org, sgk@troutmask.apl.washington.edu Cc: Ed Maste Subject: Re: Can't load linux64.ko module Date: Mon, 09 Apr 2018 12:41:07 -0700 Message-ID: <1705675.KsztJEaACH@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <20180404213453.GA35165@troutmask.apl.washington.edu> References: <20180403162600.GA23894@troutmask.apl.washington.edu> <20180404211315.GA35006@troutmask.apl.washington.edu> <20180404213453.GA35165@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 09 Apr 2018 15:52:42 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2018 19:52:43 -0000 On Wednesday, April 04, 2018 02:34:53 PM Steve Kargl wrote: > On Wed, Apr 04, 2018 at 02:13:15PM -0700, Steve Kargl wrote: > > > > OK, so where is elf64_linux_vdso_fixup suppose to come from? > > > > The answer is compat/linux/linux_vdso.c where we find > > #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) > #define __ELF_WORD_SIZE 32 > #else > #define __ELF_WORD_SIZE 64 > #endif > > having COMPAT_LINUX32 in my kernel config file gives me > elf32_linux_vdso_fixup. It seems that one cannot have > a kernel that supports both 32 and 64-bit linux software. > > linux(4) states > > for an amd64 kernel use: > > options COMPAT_LINUX32 > > Alternatively, to load the ABI as a module at boot time, place the > following line in loader.conf(5): > > linux_load="YES" > > It turns out that I have 'linux_load=YES" in /etc/loader.conf. > When I boot the kernel built with COMPAT_LINUX32 prevents > the kldload of linux64.ko. > > Oh well, learn something new everyday. The Right Way to fix this is probably to have linux_vdso32.c and linux_vdso64.c that #include linux_vdso.c after setting ELF_WORD_SIZE similar to how sys/kern/imgact_elf.c works. Then the COMPAT_LINUX and linux64.ko modules would include linux_vdso64.c and COMPAT_LINUX32 and linux32.ko modules (and linux.ko on i386) would include linux_vdso32.c. -- John Baldwin