Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Apr 2024 13:12:14 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        FreeBSD User <freebsd@walstatt-de.de>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 800da341bc4a - main - thread: Simplify sanitizer integration with thread creation
Message-ID:  <ZiaaboOa5ZIL3jjl@nuc>
In-Reply-To: <20240422190658.51b1484e@thor.intern.walstatt.dynvpn.de>
References:  <202404221554.43MFsR3n041218@gitrepo.freebsd.org> <20240422190658.51b1484e@thor.intern.walstatt.dynvpn.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 22, 2024 at 07:06:31PM +0200, FreeBSD User wrote:
> Am Mon, 22 Apr 2024 15:54:27 GMT
> Mark Johnston <markj@FreeBSD.org> schrieb:
> 
> > The branch main has been updated by markj:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=800da341bc4a35f4b4d82d104b130825d9a42ffa
> > 
> > commit 800da341bc4a35f4b4d82d104b130825d9a42ffa
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2024-04-22 15:43:17 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2024-04-22 15:46:59 +0000
> > 
> >     thread: Simplify sanitizer integration with thread creation
> >     
> >     fork() may allocate a new thread in one of two ways: from UMA, or cached
> >     in a freed proc that was just allocated from UMA.  In either case, KASAN
> >     and KMSAN need to initialize some state; in particular they need to
> >     initialize the shadow mapping of the new thread's stack.
> >     
> >     This is done differently between KASAN and KMSAN, which is confusing.
> >     This patch improves things a bit:
> >     - Add a new thread_recycle() function, which moves all kernel stack
> >       handling out of kern_fork.c, since it doesn't really belong there.
> >     - Then, thread_alloc_stack() has only one local caller, so just inline
> >       it.
> >     - Avoid redundant shadow stack initialization: thread_alloc()
> >       initializes the KMSAN shadow stack (via kmsan_thread_alloc()) even
> >       through vm_thread_new() already did that.
> >     - Add kasan_thread_alloc(), for consistency with kmsan_thread_alloc().
> >     
> >     No functional change intended.
> >     
> >     Reviewed by:    khng
> >     MFC after:      1 week
> >     Differential Revision:  https://reviews.freebsd.org/D44891
> > [...]
> It seems to me that this commit breaks make buildkernel:
> 
> [...]
> ===> accf_dns (all)
> --- kern_thread.o ---
> /usr/src/sys/kern/kern_thread.c:801:2: error: call to undeclared function
> 'kasan_thread_alloc'; ISO C99 and later do not support implicit function declarations
> [-Werror,-Wimplicit-function-declaration] 801 |         kasan_thread_alloc(td); |         ^
> /usr/src/sys/kern/kern_thread.c:818:2: error: call to undeclared function
> 'kasan_thread_alloc'; ISO C99 and later do not support implicit function declarations
> [-Werror,-Wimplicit-function-declaration] --- modules-all --- --- all_subdir_accf_http ---
> ===> accf_http (all)
> --- kern_thread.o ---
>   818 |         kasan_thread_alloc(td);
>       |         ^
> 2 errors generated.

I've just pushed a commit to fix this.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZiaaboOa5ZIL3jjl>