linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [ARM64][GCC10] Kernel can't load any module due to RWX check
@ 2020-08-29  7:44 Qu Wenruo
  2020-08-29  7:49 ` Qu Wenruo
  2020-09-01 12:53 ` Will Deacon
  0 siblings, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2020-08-29  7:44 UTC (permalink / raw)
  To: linux-modules, linux-arm-kernel


[-- Attachment #1.1.1: Type: text/plain, Size: 1262 bytes --]

Hi,

Recently built a v5.9-rc2 kernel, it boots fine, but unable to load any
kernel module.

After some debugging, it shows that it's due to RWX check failure:

  load_module: start
  module_enforce_rwx_sections: index=22 sh_flags=0x7 shf_wx=0x5
  layout_and_allocate: module enforce rwx sections
  load_module: failed to alloc layout and allocate
  load_module: end

Futhermore, it's unable to disable the RWX check through "make
menuconfig", since the ARCH_OPTIONAL_KERNEL_RWX is no for arm64.

The offending section 22 looks like this: (the kernel reports 38
sectors, while we only have 37, thus near-by sections are also shown here).

 20 .data         00000aa0  0000000000000000  0000000000000000  00086d08
 2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 21 __bug_table   000000cc  0000000000000000  0000000000000000  000877a8
 2**2
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 22 __dyndbg      0000b9b8  0000000000000000  0000000000000000  00087878
 2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
 23 .data.unlikely 00000012  0000000000000000  0000000000000000
00093230  2**0
                  CONTENTS, ALLOC, LOAD, DATA

I'm using GCC 10.2.0, could this be the cause?

Thanks,
Qu




[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 5+ messages in thread

* Re: [ARM64][GCC10] Kernel can't load any module due to RWX check
  2020-08-29  7:44 [ARM64][GCC10] Kernel can't load any module due to RWX check Qu Wenruo
@ 2020-08-29  7:49 ` Qu Wenruo
  2020-08-29  7:57   ` Qu Wenruo
  2020-08-29 10:03   ` peterz
  2020-09-01 12:53 ` Will Deacon
  1 sibling, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2020-08-29  7:49 UTC (permalink / raw)
  To: linux-modules, linux-arm-kernel, peterz


[-- Attachment #1.1.1: Type: text/plain, Size: 1650 bytes --]



On 2020/8/29 下午3:44, Qu Wenruo wrote:
> Hi,
> 
> Recently built a v5.9-rc2 kernel, it boots fine, but unable to load any
> kernel module.
> 
> After some debugging, it shows that it's due to RWX check failure:
> 
>   load_module: start
>   module_enforce_rwx_sections: index=22 sh_flags=0x7 shf_wx=0x5
>   layout_and_allocate: module enforce rwx sections
>   load_module: failed to alloc layout and allocate
>   load_module: end
> 
> Futhermore, it's unable to disable the RWX check through "make
> menuconfig", since the ARCH_OPTIONAL_KERNEL_RWX is no for arm64.
> 
> The offending section 22 looks like this: (the kernel reports 38
> sectors, while we only have 37, thus near-by sections are also shown here).
> 
>  20 .data         00000aa0  0000000000000000  0000000000000000  00086d08
>  2**3
>                   CONTENTS, ALLOC, LOAD, RELOC, DATA
>  21 __bug_table   000000cc  0000000000000000  0000000000000000  000877a8
>  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, DATA
>  22 __dyndbg      0000b9b8  0000000000000000  0000000000000000  00087878
>  2**3
>                   CONTENTS, ALLOC, LOAD, RELOC, DATA
>  23 .data.unlikely 00000012  0000000000000000  0000000000000000
> 00093230  2**0
>                   CONTENTS, ALLOC, LOAD, DATA
> 
> I'm using GCC 10.2.0, could this be the cause?

I should check the git log, the module_enforce_rwx_sections() is just
recently added by commit 5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX").

Hi Peter, any idea how could this commit causing a regression on arm64
but not on x86_64?

Thanks,
Qu

> 
> Thanks,
> Qu
> 
> 
> 


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 5+ messages in thread

* Re: [ARM64][GCC10] Kernel can't load any module due to RWX check
  2020-08-29  7:49 ` Qu Wenruo
@ 2020-08-29  7:57   ` Qu Wenruo
  2020-08-29 10:03   ` peterz
  1 sibling, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2020-08-29  7:57 UTC (permalink / raw)
  To: linux-modules, linux-arm-kernel, peterz


[-- Attachment #1.1.1: Type: text/plain, Size: 1905 bytes --]



On 2020/8/29 下午3:49, Qu Wenruo wrote:
> 
> 
> On 2020/8/29 下午3:44, Qu Wenruo wrote:
>> Hi,
>>
>> Recently built a v5.9-rc2 kernel, it boots fine, but unable to load any
>> kernel module.
>>
>> After some debugging, it shows that it's due to RWX check failure:
>>
>>   load_module: start
>>   module_enforce_rwx_sections: index=22 sh_flags=0x7 shf_wx=0x5
>>   layout_and_allocate: module enforce rwx sections
>>   load_module: failed to alloc layout and allocate
>>   load_module: end
>>
>> Futhermore, it's unable to disable the RWX check through "make
>> menuconfig", since the ARCH_OPTIONAL_KERNEL_RWX is no for arm64.
>>
>> The offending section 22 looks like this: (the kernel reports 38
>> sectors, while we only have 37, thus near-by sections are also shown here).
>>
>>  20 .data         00000aa0  0000000000000000  0000000000000000  00086d08
>>  2**3
>>                   CONTENTS, ALLOC, LOAD, RELOC, DATA
>>  21 __bug_table   000000cc  0000000000000000  0000000000000000  000877a8
>>  2**2
>>                   CONTENTS, ALLOC, LOAD, RELOC, DATA
>>  22 __dyndbg      0000b9b8  0000000000000000  0000000000000000  00087878
>>  2**3
>>                   CONTENTS, ALLOC, LOAD, RELOC, DATA
>>  23 .data.unlikely 00000012  0000000000000000  0000000000000000
>> 00093230  2**0
>>                   CONTENTS, ALLOC, LOAD, DATA
>>
>> I'm using GCC 10.2.0, could this be the cause?
> 
> I should check the git log, the module_enforce_rwx_sections() is just
> recently added by commit 5c3a7db0c7ec ("module: Harden STRICT_MODULE_RWX").
> 
> Hi Peter, any idea how could this commit causing a regression on arm64
> but not on x86_64?

And obviously, reverting it solves the problem of mine.
(Now happy working 4K sector size btrfs support on 64K page size system)

Thanks,
Qu

> 
> Thanks,
> Qu
> 
>>
>> Thanks,
>> Qu
>>
>>
>>
> 


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 5+ messages in thread

* Re: [ARM64][GCC10] Kernel can't load any module due to RWX check
  2020-08-29  7:49 ` Qu Wenruo
  2020-08-29  7:57   ` Qu Wenruo
@ 2020-08-29 10:03   ` peterz
  1 sibling, 0 replies; 5+ messages in thread
From: peterz @ 2020-08-29 10:03 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: masahiroy, linux-modules, jeyu, will, ardb, linux-arm-kernel

On Sat, Aug 29, 2020 at 03:49:36PM +0800, Qu Wenruo wrote:

> Hi Peter, any idea how could this commit causing a regression on arm64
> but not on x86_64?

It's a bug^Wfeature in binutils-2.35.

See this thread: https://lkml.kernel.org/r/20200808101222.5103093e@coco.lan

People are working on a fix, see the tail of that thread.

_______________________________________________
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] 5+ messages in thread

* Re: [ARM64][GCC10] Kernel can't load any module due to RWX check
  2020-08-29  7:44 [ARM64][GCC10] Kernel can't load any module due to RWX check Qu Wenruo
  2020-08-29  7:49 ` Qu Wenruo
@ 2020-09-01 12:53 ` Will Deacon
  1 sibling, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-09-01 12:53 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-arm-kernel, linux-modules

On Sat, Aug 29, 2020 at 03:44:37PM +0800, Qu Wenruo wrote:
> Recently built a v5.9-rc2 kernel, it boots fine, but unable to load any
> kernel module.
> 
> After some debugging, it shows that it's due to RWX check failure:
> 
>   load_module: start
>   module_enforce_rwx_sections: index=22 sh_flags=0x7 shf_wx=0x5
>   layout_and_allocate: module enforce rwx sections
>   load_module: failed to alloc layout and allocate
>   load_module: end

May well be related to:

https://lore.kernel.org/r/20200831094651.GA16385@linux-8ccs

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] 5+ messages in thread

end of thread, other threads:[~2020-09-01 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29  7:44 [ARM64][GCC10] Kernel can't load any module due to RWX check Qu Wenruo
2020-08-29  7:49 ` Qu Wenruo
2020-08-29  7:57   ` Qu Wenruo
2020-08-29 10:03   ` peterz
2020-09-01 12:53 ` Will Deacon

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).