r...@esmil.dk>, Jordan Niethe <jniet...@gmail.com>, Atish Patra 
<ati...@atishpatra.org>, Alexei Starovoitov <a...@kernel.org>, Will Deacon 
<w...@kernel.org>, Masahiro Yamada <masahi...@kernel.org>, Jarkko Sakkinen 
<jar...@profian.com>, Sami Tolvanen <samitolva...@google.com>, "Naveen N. Rao" 
<naveen.n....@linux.ibm.com>, Marco Elver <el...@google.com>, Kees Cook 
<keesc...@chromium.org>, Steven Rostedt <rost...@goodmis.org>, Nathan 
Chancellor <nat...@kernel.org>, Mark Brown <broo...@kernel.org>, Borislav 
Petkov <b...@alien8.de>, Alexander Egorenkov <egore...@linux.ibm.com>, Thomas 
Bogendoerfer <tsbog...@alpha.franken.de>, "linux-par...@vger.kernel.org" 
<linux-par...@vger.kernel.org>, Nathaniel McCallum <nathan...@profian.com>, 
Dmitry Torokhov <dmitry.torok...@gmail.com>, "David S. Miller" 
<da...@davemloft.net>, "Kirill A. Shutemov" <kirill.shute...@linux.intel.com>, 
Tobias Huschle <husc...@linux.ibm.com>, "Peter Zijlstra \(Intel\)" 
<pet...@infradead.org>, "H. Peter Anvin" <h...@zytor.com>
 , "sparcli...@vger.kernel.org" <sparcli...@vger.kernel.org>, Tiezhu Yang 
<yangtie...@loongson.cn>, Miroslav Benes <mbe...@suse.cz>, Chen Zhongjin 
<chenzhong...@huawei.com>, Ard Biesheuvel <a...@kernel.org>, "x...@kernel.org" 
<x...@kernel.org>, "Russell King \(Oracle\)" <li...@armlinux.org.uk>, 
"linux-ri...@lists.infradead.org" <linux-ri...@lists.infradead.org>, Ingo 
Molnar <mi...@redhat.com>, Aaron Tomlin <atom...@redhat.com>, Albert Ou 
<a...@eecs.berkeley.edu>, Heiko Carstens <h...@linux.ibm.com>, Liao Chang 
<liaocha...@huawei.com>, Paul Walmsley <paul.walms...@sifive.com>, Josh 
Poimboeuf <jpoim...@kernel.org>, Thomas Richter <tmri...@linux.ibm.com>, 
"linux-m...@vger.kernel.org" <linux-m...@vger.kernel.org>, Changbin Du 
<changbin...@intel.com>, Palmer Dabbelt <pal...@dabbelt.com>, 
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>, 
"linux-modu...@vger.kernel.org" <linux-modu...@vger.kernel.org>
Errors-To: linuxppc-dev-bounces+archive=mail-archive....@lists.ozlabs.org
Sender: "Linuxppc-dev" 
<linuxppc-dev-bounces+archive=mail-archive....@lists.ozlabs.org>

On Tue, Jun 14, 2022 at 12:36:25PM +0000, Christophe Leroy wrote:
> 
> 
> Le 14/06/2022 à 14:26, Jarkko Sakkinen a écrit :
> > On Thu, Jun 09, 2022 at 06:44:45AM -0700, Luis Chamberlain wrote:
> >> On Thu, Jun 09, 2022 at 08:47:38AM +0100, Russell King (Oracle) wrote:
> >>> On Wed, Jun 08, 2022 at 02:59:27AM +0300, Jarkko Sakkinen wrote:
> >>>> diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
> >>>> index 553866751e1a..d2bb954cd54f 100644
> >>>> --- a/arch/arm/kernel/Makefile
> >>>> +++ b/arch/arm/kernel/Makefile
> >>>> @@ -44,6 +44,11 @@ obj-$(CONFIG_CPU_IDLE)                += cpuidle.o
> >>>>   obj-$(CONFIG_ISA_DMA_API)      += dma.o
> >>>>   obj-$(CONFIG_FIQ)              += fiq.o fiqasm.o
> >>>>   obj-$(CONFIG_MODULES)          += armksyms.o module.o
> >>>> +ifeq ($(CONFIG_MODULES),y)
> >>>> +obj-y                           += module_alloc.o
> >>>> +else
> >>>> +obj-$(CONFIG_KPROBES)           += module_alloc.o
> >>>> +endif
> >>>
> >>> Doesn't:
> >>>
> >>> obj-$(CONFIG_MODULES)             += module_alloc.o
> >>> obj-$(CONFIG_KPROBES)             += module_alloc.o
> >>
> >> That just begs for a new kconfig symbol for the object, and for
> >> the object then to be built with it.
> >>
> >> The archs which override the default can use ARCH_HAS_VM_ALLOC_EXEC.
> >> Please note that the respective free is important as well and its
> >> not clear if we need an another define for the free. Someone has
> >> to do that work. We want to ensure to noexec the code on free and
> >> this can vary on each arch.
> > 
> > Let me check if I understand this (not 100% sure).
> > 
> > So if arch define ARCH_HAS_VMALLOC_EXEC, then this would set
> > config flag CONFIG_VMALLOC_EXEC, which would be used to include
> > the compilation unit?
> > 
> 
> I guess you have two possible approaches.
> 
> Either architectures select CONFIG_ARCH_HAS_VMALLOC_EXEC at all time and 
> then you add a CONFIG_VMALLOC_EXEC which depends on 
> CONFIG_ARCH_HAS_VMALLOC_EXEC and CONFIG_MODULES or CONFIG_KPROBES,
> 
> Or architectures select CONFIG_ARCH_HAS_VMALLOC_EXEC only when either 
> CONFIG_MODULES or CONFIG_KPROBES is selected, in that case there is no 
> need for a CONFIG_VMALLOC_EXEC.

Right, got it now. Thanks for the elaboration.

> Christophe

BR, Jarkko

Reply via email to