Date: Tue, 28 Apr 2026 14:45:39 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Lexi Winter <ivy@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ba94d7574972 - main - stand/common/load_elf: Do kernel module relocations for PPC Message-ID: <CAJ-VmokRSEkWL9rdXS5iNWOes_nvCyWymdwbipasFiF03_z4nA@mail.gmail.com> In-Reply-To: <69e37435.3b47e.5048e12@gitrepo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
hi, This somehow breaks booting in pseries VMs in virtualised ppc64 on qemu, both ppc64be and ppc64le. The loader gets through a bunch of kernel loading and then hangs before it jumps into the kernel. -adrian On Sat, 18 Apr 2026 at 05:08, Lexi Winter <ivy@freebsd.org> wrote: > > The branch main has been updated by ivy: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ba94d75749721fae999f756cb227638f9d4398a8 > > commit ba94d75749721fae999f756cb227638f9d4398a8 > Author: Lexi Winter <ivy@FreeBSD.org> > AuthorDate: 2026-04-18 12:07:10 +0000 > Commit: Lexi Winter <ivy@FreeBSD.org> > CommitDate: 2026-04-18 12:07:10 +0000 > > stand/common/load_elf: Do kernel module relocations for PPC > > reloc_ptr() skips relocations for the kernel module, because on most > platforms the kernel is ET_EXEC and this is not required. On PPC, > the kernel is ET_DYN and we need to relocate here, otherwise the > module metadata will not be loaded properly and the kernel module > will have an incorrect version, preventing module dependencies from > resolving. > > This fixes loading kernel modules from loader.conf on powerpc. > > Diagnosed by: jrtc27 > Reviewed by: jrtc27, adrian > Sponsored by: https://www.patreon.com/bsdivy > Differential Revision: https://reviews.freebsd.org/D56457 > --- > stand/common/load_elf.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c > index 10131f7ccb88..a6ea60c74b84 100644 > --- a/stand/common/load_elf.c > +++ b/stand/common/load_elf.c > @@ -1282,10 +1282,11 @@ __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, > int error; > > /* > - * The kernel is already relocated, but we still want to apply > - * offset adjustments. > + * On most platforms, the kernel is already relocated, but we still > + * want to apply offset adjustments. For PowerPC, the kernel is > + * ET_DYN rather than ET_EXEC and we still need to relocate here. > */ > - if (ef->kernel) > + if (ef->kernel && ef->ehdr->e_type != ET_DYN) > return (EOPNOTSUPP); > > for (n = 0; n < ef->relsz / sizeof(r); n++) { >home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmokRSEkWL9rdXS5iNWOes_nvCyWymdwbipasFiF03_z4nA>
