Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,
	Ferran Duarri <ferran.duarri@me.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] kbuild: ubsan: skip UBSAN for external modules by default
Date: Tue, 1 Sep 2026 11:42:46 -0700	[thread overview]
Message-ID: <202609011138.9FE4254@keescook> (raw)
In-Reply-To: <aoisfLPgD33M0sRt@levanger>

On Fri, Aug 21, 2026 at 09:52:28PM +0200, Nicolas Schier wrote:
> On Fri, Aug 21, 2026 at 12:07:01PM -0700, Nathan Chancellor wrote:
> > + Kees and linux-hardening@ for visibility
> > 
> > On Thu, Aug 20, 2026 at 09:01:58PM +0200, Ferran Duarri wrote:
> > > External modules built with KBUILD_EXTMOD set inherit UBSAN sanitizer
> > > flags from the kernel's KBUILD_CFLAGS because is-kernel-object is 'y'
> > > for any obj-m object. This silently breaks third-party modules whose
> > > source code (e.g. VMware vmnet/vmmon) triggers UBSAN UB checks at
> > > runtime, causing packet-forwarding failures and VM instability while
> > > the module itself loads successfully.
> > > 
> > > Make UBSAN opt-in for external modules: skip the is-kernel-object 'y'
> > > fallback when KBUILD_EXTMOD is set. External modules that explicitly
> > > need UBSAN can still opt in by setting UBSAN_SANITIZE := y.
> > > 
> > > In-kernel module builds are not affected.
> > > Signed-off-by: Ferran Duarri <ferran.duarri@me.com>
> > 
> > I am open to other opinions but I am not inclined to apply this change.
> > If an external module has issues with these checks, it should either be
> > fixed or 'UBSAN_SANITIZE := n' can be added to the module's Makefile,
> > rather than making the default worse for everyone else, especially given
> > the importance of UBSAN_BOUNDS for avoiding out of bounds accesses and
> > writes.
> 
> Yes, I second that.

Correct. And (unsurprisingly) I take an even harder line: the
external module source should be fixed, full stop. Disabling it with
"UBSAN_SANITIZE := n" is just a localized version of the proposed patch.
The whole point of these defense in the kernel is to stop bad code
from operating.

The out-of-tree code needs to be fixed. If it can't run with these
features enabled, it is an active threat to the safety of the users of
systems with that code running in their kernels. If VMware can't fix
this, no one should be using that code.

-Kees

-- 
Kees Cook

  reply	other threads:[~2026-09-01 18:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 19:01 [PATCH] kbuild: ubsan: skip UBSAN for external modules by default Ferran Duarri
2026-08-21 19:07 ` Nathan Chancellor
2026-08-21 19:52   ` Nicolas Schier
2026-09-01 18:42     ` Kees Cook [this message]
2026-08-31 13:17   ` Ferran Duarri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202609011138.9FE4254@keescook \
    --to=kees@kernel.org \
    --cc=ferran.duarri@me.com \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox