linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS
@ 2019-06-17 22:29 Florian Fainelli
  2019-06-18  9:29 ` Will Deacon
  2019-06-25  8:29 ` Catalin Marinas
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2019-06-17 22:29 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Florian Fainelli, ard.biesheuvel, Catalin Marinas, Will Deacon,
	open list, bcm-kernel-feedback-list

Make ARM64_MODULE_PLTS a selectable Kconfig symbol, since some people
might have very big modules spilling out of the dedicated module area
into vmalloc. Help text is copied from the ARM 32-bit counterpart and
modified to a mention of KASLR and specific ARM errata workaround(s).

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v3:
- take out the part about "The modules will use slightly more memory, but after
  rounding up to page size, the actual memory footprint is usually the same.
- take out the "If unusure say Y", since we would really prefer this to
  be off by default for maximum performance

Changes in v2:

- added Ard's paragraph about KASLR
- added a paragraph about specific workarounds also requiring
  ARM64_MODULE_PLTS

 arch/arm64/Kconfig | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 697ea0510729..9206feaeff07 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1418,8 +1418,26 @@ config ARM64_SVE
 	  KVM in the same kernel image.
 
 config ARM64_MODULE_PLTS
-	bool
+	bool "Use PLTs to allow module memory to spill over into vmalloc area"
 	select HAVE_MOD_ARCH_SPECIFIC
+	help
+	  Allocate PLTs when loading modules so that jumps and calls whose
+	  targets are too far away for their relative offsets to be encoded
+	  in the instructions themselves can be bounced via veneers in the
+	  module's PLT. This allows modules to be allocated in the generic
+	  vmalloc area after the dedicated module memory area has been
+	  exhausted.
+
+	  When running with address space randomization (KASLR), the module
+	  region itself may be too far away for ordinary relative jumps and
+	  calls, and so in that case, module PLTs are required and cannot be
+	  disabled.
+
+	  Specific errata workaround(s) might also force module PLTs to be
+	  enabled (ARM64_ERRATUM_843419).
+
+	  Disabling this is usually safe for small single-platform
+	  configurations.
 
 config ARM64_PSEUDO_NMI
 	bool "Support for NMI-like interrupts"
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS
  2019-06-17 22:29 [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS Florian Fainelli
@ 2019-06-18  9:29 ` Will Deacon
  2019-06-25  8:29 ` Catalin Marinas
  1 sibling, 0 replies; 4+ messages in thread
From: Will Deacon @ 2019-06-18  9:29 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Catalin Marinas, bcm-kernel-feedback-list, open list,
	linux-arm-kernel, ard.biesheuvel

On Mon, Jun 17, 2019 at 03:29:59PM -0700, Florian Fainelli wrote:
> Make ARM64_MODULE_PLTS a selectable Kconfig symbol, since some people
> might have very big modules spilling out of the dedicated module area
> into vmalloc. Help text is copied from the ARM 32-bit counterpart and
> modified to a mention of KASLR and specific ARM errata workaround(s).
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Changes in v3:
> - take out the part about "The modules will use slightly more memory, but after
>   rounding up to page size, the actual memory footprint is usually the same.
> - take out the "If unusure say Y", since we would really prefer this to
>   be off by default for maximum performance
> 
> Changes in v2:
> 
> - added Ard's paragraph about KASLR
> - added a paragraph about specific workarounds also requiring
>   ARM64_MODULE_PLTS
> 
>  arch/arm64/Kconfig | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 697ea0510729..9206feaeff07 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1418,8 +1418,26 @@ config ARM64_SVE
>  	  KVM in the same kernel image.
>  
>  config ARM64_MODULE_PLTS
> -	bool
> +	bool "Use PLTs to allow module memory to spill over into vmalloc area"
>  	select HAVE_MOD_ARCH_SPECIFIC
> +	help
> +	  Allocate PLTs when loading modules so that jumps and calls whose
> +	  targets are too far away for their relative offsets to be encoded
> +	  in the instructions themselves can be bounced via veneers in the
> +	  module's PLT. This allows modules to be allocated in the generic
> +	  vmalloc area after the dedicated module memory area has been
> +	  exhausted.
> +
> +	  When running with address space randomization (KASLR), the module
> +	  region itself may be too far away for ordinary relative jumps and
> +	  calls, and so in that case, module PLTs are required and cannot be
> +	  disabled.
> +
> +	  Specific errata workaround(s) might also force module PLTs to be
> +	  enabled (ARM64_ERRATUM_843419).
> +
> +	  Disabling this is usually safe for small single-platform
> +	  configurations.

I think I'd still drop this last sentence, because labelling a kernel
"usually safe" without this option is a bit OTT. We'll just reject large
modules, nothing unsafe about that.

Assuming Catalin can do that when he applies, so:

Acked-by: Will Deacon <will.deacon@arm.com>

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS
  2019-06-17 22:29 [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS Florian Fainelli
  2019-06-18  9:29 ` Will Deacon
@ 2019-06-25  8:29 ` Catalin Marinas
  2019-06-26 17:05   ` Florian Fainelli
  1 sibling, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2019-06-25  8:29 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Will Deacon, bcm-kernel-feedback-list, open list,
	linux-arm-kernel, ard.biesheuvel

On Mon, Jun 17, 2019 at 03:29:59PM -0700, Florian Fainelli wrote:
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 697ea0510729..9206feaeff07 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1418,8 +1418,26 @@ config ARM64_SVE
>  	  KVM in the same kernel image.
>  
>  config ARM64_MODULE_PLTS
> -	bool
> +	bool "Use PLTs to allow module memory to spill over into vmalloc area"
>  	select HAVE_MOD_ARCH_SPECIFIC

This needs a depends on MODULES now (it failed to build in one of my
tests where modules were disabled but this option was left enabled).

I'll add a patch on top.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS
  2019-06-25  8:29 ` Catalin Marinas
@ 2019-06-26 17:05   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2019-06-26 17:05 UTC (permalink / raw)
  To: Catalin Marinas, Florian Fainelli
  Cc: Will Deacon, bcm-kernel-feedback-list, open list,
	linux-arm-kernel, ard.biesheuvel

On 6/25/19 1:29 AM, Catalin Marinas wrote:
> On Mon, Jun 17, 2019 at 03:29:59PM -0700, Florian Fainelli wrote:
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 697ea0510729..9206feaeff07 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -1418,8 +1418,26 @@ config ARM64_SVE
>>  	  KVM in the same kernel image.
>>  
>>  config ARM64_MODULE_PLTS
>> -	bool
>> +	bool "Use PLTs to allow module memory to spill over into vmalloc area"
>>  	select HAVE_MOD_ARCH_SPECIFIC
> 
> This needs a depends on MODULES now (it failed to build in one of my
> tests where modules were disabled but this option was left enabled).
> 
> I'll add a patch on top.

Ah, sorry about that, thanks, I see both in linux-next now.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-26 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 22:29 [PATCH v3] arm64: Allow user selection of ARM64_MODULE_PLTS Florian Fainelli
2019-06-18  9:29 ` Will Deacon
2019-06-25  8:29 ` Catalin Marinas
2019-06-26 17:05   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).