[PATCH 2/2] vdso: Reject absolute relocations during build
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Apr 30 00:57:02 PDT 2025
On Wed, Apr 30, 2025 at 09:32:27AM +0200, Thomas Gleixner wrote:
> On Tue, Apr 29 2025 at 17:17, Jan Stancek wrote:
> > On Tue, Apr 29, 2025 at 2:56 PM Thomas Weißschuh
> > <thomas.weissschuh at linutronix.de> wrote:
> >>
> >> +# Also validate that no absolute relocations are present in the object files themselves.
> >> quiet_cmd_vdso_check = VDSOCHK $@
> >> cmd_vdso_check = if $(READELF) -rW $@ | grep -v _NONE | grep -q " R_\w*_"; \
> >> then (echo >&2 "$@: dynamic relocations are not supported"; \
> >> + rm -f $@; /bin/false); fi && \
> >> + if $(READELF) -rW $(filter %.o, $(real-prereqs)) | grep -q " R_\w*_ABS"; \
> >> + then (echo >&2 "$@: absolute relocations are not supported"; \
> >> rm -f $@; /bin/false); fi
> >
> > Should this check only some sections? I'm getting lot of matches on
> > debuginfo related sections:
>
> Hmm. All architecture VDSO Makefiles have -fPIC in CFLAGS except for
> arm64, which only adds it in arm64/kernel/vdso32/Makefile but not in
> arm64/kernel/vdso/Makefile. Confused.
Unfortunately -fPIC does not help. It generates code that is sufficiently
position independent for regular DSOs, but not the vDSO.
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120002#c5
More information about the linux-arm-kernel
mailing list