Page MenuHomeFreeBSD

Add a KASAN option to the kernel build
ClosedPublic

Authored by markj on Mar 27 2021, 11:26 PM.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

emaste added inline comments.
sys/conf/kern.pre.mk
94

I wonder if (as a later change) we should get config(8) to generate a Makefile.config.inc or such that we can include?

sys/conf/kern.pre.mk
94

I don't quite follow the suggestion. You mean we would end up with a Makefile.KASAN.inc or so?

sys/conf/kern.pre.mk
94

Something like Makefile.options.inc that contains KASAN_ENABLED=yes and such, rather than invoking grep n times

This looks good to me, modulo the refactoring idea it inspired.

sys/conf/kern.pre.mk
94

Hmmm, we've grown a lot of these grep commands. I wrote a generic version of this some time ago (7.x? 8.x?)e. I thought I'd committed it, but it appears that I didn't.

Personally, I'd create a mk.$OPTION file in $S/conf. For all options that are enabled that have a mk.$OPTION have config write them into the makefile at %BEFORE_DEPEND.

But I'll be the first to admit this is beyond the scope of this patch.

This revision is now accepted and ready to land.Mar 28 2021, 4:03 PM
sys/conf/kern.pre.mk
94

I'll have to add another of these for KMSAN, so a better solution is indeed warranted. The approach of having mk.KASAN seems good. We'd need to audit all of the existing uses of "grep <OPTION> opt_foo.h" to make sure they're all amenable to this approach.

This revision was automatically updated to reflect the committed changes.