Text relocations in kernel modules

Richard Yao ryao at cs.stonybrook.edu
Fri Mar 30 17:40:02 UTC 2012


As a disclaimer, I would like to clarify that Gentoo/FreeBSD uses a
FreeBSD userland and that Gentoo/FreeBSD has nothing to do with Debian
GNU/kFreeBSD. People seem to think Gentoo/FreeBSD is related to Debian
GNU/kFreeBSD, which has made collaboration difficult.

With that said, Gentoo Portage is warning about text relocations in
kernel modules. This is in a Gentoo/FreeBSD port of
emulators/freebsd-kmod that I wrote. For instance, I see:

# readelf -d /boot/modules/virtio.ko

Dynamic section at offset 0x2f6c contains 13 entries:
  Tag        Type                         Name/Value
 0x00000004 (HASH)                       0xd4
 0x6ffffef5 (GNU_HASH)                   0x238
 0x00000005 (STRTAB)                     0x4a8
 0x00000006 (SYMTAB)                     0x298
 0x0000000a (STRSZ)                      397 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000011 (REL)                        0x638
 0x00000012 (RELSZ)                      1568 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000016 (TEXTREL)                    0x0
 0x0000001e (FLAGS)                      TEXTREL
 0x6ffffffa (RELCOUNT)                   108
 0x00000000 (NULL)                       0x0

Checking /boot/kernel, it seems that all modules have text relocations.
My Gentoo/FreeBSD install is a 32-bit chroot on a ZFS Guru install of
amd64 FreeBSD. amd64 FreeBSD does not appear to have any text relocations.

I don't have a reference i386 install, but according to frogs in
##freebsd on freenode, his i386 FreeBSD also has text relocations.

Is this a bug?

Yours truly,
Richard Yao

On 03/30/12 12:49, Richard Yao wrote:
> Dear Ports Maintainers and kuriyama,
> 
> emulators/freebsd-kmod has a typo in pkg-descr, where it says "lodable"
> instead of "loadable".
> 
> In addition, I have done the work necessary to port
> emulators/freebsd-kmod to Gentoo/FreeBSD.
> 
> https://bugs.gentoo.org/show_bug.cgi?id=410199
> 
> The ebuild contains a few improvements on the original FreeBSD port
> where we copy only the parts of SYSDIR that we need to build the module.
> We also do hardlinks instead of copies when Gentoo Portage builds with
> user privileges.
> 
> The NEEDSUBDIRS part of the ebuild was written by naota AT gentoo.org as
> part of Gentoo's review process. I have permission from him to upstream
> the improvements we made on the port. Feel free to adopt any
> improvements in the attachments in that bug report.
> 
> Lastly, I have sent an email to gentoo-dev AT lists.gentoo.org and
> gentoo-bsd AT lists.gentoo.org requesting that the FreeBSD specific
> parts of the portage tree be relicensed under terms of the BSD-2
> license. With a little luck, it will be possible to upstream
> improvements made in Gentoo/FreeBSD without any hassle in the future.
> 
> Yours truly,
> Richard Yao
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20120330/a394592a/signature.pgp


More information about the freebsd-stable mailing list