]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix dpcpu and vnet panics with complex types at the end of the section.
authorbz <bz@FreeBSD.org>
Sat, 8 Jun 2019 17:44:42 +0000 (17:44 +0000)
committerbz <bz@FreeBSD.org>
Sat, 8 Jun 2019 17:44:42 +0000 (17:44 +0000)
commit24f298a9c6647e1fd9bb4c488d992e3ddac3b718
tree472461a5634a9fe019157b8fce4dfb15d4d48428
parent1bbb27fcde21c2d29ecd1e4fbac59d28b595fba0
Fix dpcpu and vnet panics with complex types at the end of the section.

Apply a linker script when linking i386 kernel modules to apply padding
to a set_pcpu or set_vnet section.  The padding value is kind-of random
and is used to catch modules not compiled with the linker-script, so
possibly still having problems leading to kernel panics.

This is needed as the code generated on certain architectures for
non-simple-types, e.g., an array can generate an absolute relocation
on the edge (just outside) the section and thus will not be properly
relocated. Adding the padding to the end of the section will ensure
that even absolute relocations of complex types will be inside the
section, if they are the last object in there and hence relocation will
work properly and avoid panics such as observed with carp.ko or ipsec.ko.

There is a rather lengthy discussion of various options to apply in
the mentioned PRs and their depends/blocks, and the review.
There seems no best solution working across multiple toolchains and
multiple version of them, so I took the liberty of taking one,
as currently our users (and our CI system) are hitting this on
just i386 and we need some solution.  I wish we would have a proper
fix rather than another "hack".

Also backout r340009 which manually, temporarily fixed CARP before 12.0-R
"by chance" after a lead-up of various other link-elf.c and related fixes.

PR: 230857,238012
With suggestions from: arichardson (originally last year)
Tested by: lwhsu
Event: Waterloo Hackathon 2019
Reported by: lwhsu, olivier
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D17512
UPDATING
sys/conf/kmod.mk
sys/conf/ldscript.set_padding [new file with mode: 0644]
sys/kern/link_elf.c
sys/netinet/ip_carp.c
sys/sys/param.h