Page MenuHomeFreeBSD

sanitizers: Avoid building genassym.c and genoffset.c with sanitizers
AcceptedPublic

Authored by markj on Oct 11 2023, 1:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 23, 8:16 AM
Unknown Object (File)
Nov 16 2025, 2:18 AM
Unknown Object (File)
Nov 12 2025, 7:49 AM
Unknown Object (File)
Nov 11 2025, 12:16 AM
Unknown Object (File)
Oct 29 2025, 11:43 AM
Unknown Object (File)
Oct 29 2025, 11:30 AM
Unknown Object (File)
Oct 29 2025, 10:27 AM
Unknown Object (File)
Oct 29 2025, 2:59 AM
Subscribers

Details

Reviewers
emaste
andrew
imp
Summary

Some, particularly KASAN, may insert redzones around global symbols,
resulting in incorrect offset definitions because genassym.sh defines
some semantics using symbol sizes.

Ideally I would be able to define this pattern in one place, but I
haven't found a way to define a GENSYM_CFLAGS that actually works for
all of the consumers (kern.post.mk, kmod.mk, sys/conf/files*).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 53925
Build 50815: arc lint + arc unit

Event Timeline

markj requested review of this revision.Oct 11 2023, 1:46 PM
markj created this revision.

I wonder why amd64 is the only one with a <32>_genassym.o

Funny, I stumbled on the genassym/genoffset mechanisms yesterday. FWIW, LGTM.

I wonder why amd64 is the only one with a <32>_genassym.o

You mean, why doesn't arm64 have one as well? It looks like ia32_genassym defines symbols used by the 32-bit signal trampoline. On arm64, aarch32_sigcode is stuck at the end of locore and uses hex constants instead of actual instructions, so it doesn't need to define SIGF_UC etc.

It would be nice if there was a common place we could define this pattern, but I'm not aware of a clean way to do it. I had the same issue in 0e8b3ab34883efedeeb5e0d3baa90ea98de1e692. Note there are a couple of modules in that change that have their own genassym invocations.

This revision is now accepted and ready to land.Oct 11 2023, 2:06 PM

Fix genassym invocations in sys/modules

This revision now requires review to proceed.Oct 11 2023, 2:10 PM
This revision is now accepted and ready to land.Oct 11 2023, 2:12 PM

I guess this is a good indication that we should find a common way to do this. But I think it's fine to commit this to fix the immediate issue and see if @imp or @sjg has a suggestion.

We could handle the kernel modules via bsd.kmod.mk, at least.