LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
@ 2018-05-28 3:33 nixiaoming
2018-05-29 9:21 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: nixiaoming @ 2018-05-28 3:33 UTC (permalink / raw)
To: catalin.marinas, will.deacon, ard.biesheuvel, marc.zyngier,
james.morse, kristina.martsenko, steve.capper
Cc: nixiaoming, linux-kernel, linux-arm-kernel
Signed-off-by: nixiaoming <nixiaoming@huawei.com>
---
arch/arm64/mm/mmu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 2dbb2c9..849f326 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -491,6 +491,7 @@ static void __init map_mem(pgd_t *pgdp)
#endif
}
+#ifdef CONFIG_STRICT_KERNEL_RWX
void mark_rodata_ro(void)
{
unsigned long section_size;
@@ -505,6 +506,7 @@ void mark_rodata_ro(void)
debug_checkwx();
}
+#endif
static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end,
pgprot_t prot, struct vm_struct *vma,
--
2.10.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
2018-05-28 3:33 [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro nixiaoming
@ 2018-05-29 9:21 ` Will Deacon
0 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2018-05-29 9:21 UTC (permalink / raw)
To: nixiaoming
Cc: catalin.marinas, ard.biesheuvel, marc.zyngier, james.morse,
kristina.martsenko, steve.capper, linux-kernel, linux-arm-kernel
On Mon, May 28, 2018 at 11:33:53AM +0800, nixiaoming wrote:
> Signed-off-by: nixiaoming <nixiaoming@huawei.com>
Please can you write a commit message explaining what this fixes and also
give me a pointer to patches 2 and 3 from this series?
Will
> ---
> arch/arm64/mm/mmu.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 2dbb2c9..849f326 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -491,6 +491,7 @@ static void __init map_mem(pgd_t *pgdp)
> #endif
> }
>
> +#ifdef CONFIG_STRICT_KERNEL_RWX
> void mark_rodata_ro(void)
> {
> unsigned long section_size;
> @@ -505,6 +506,7 @@ void mark_rodata_ro(void)
>
> debug_checkwx();
> }
> +#endif
>
> static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end,
> pgprot_t prot, struct vm_struct *vma,
> --
> 2.10.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
2018-05-30 8:08 ` Mark Rutland
@ 2018-05-30 9:05 ` Nixiaoming
0 siblings, 0 replies; 7+ messages in thread
From: Nixiaoming @ 2018-05-30 9:05 UTC (permalink / raw)
To: Mark Rutland, Ard Biesheuvel, Ingo Molnar, Will Deacon, Greg KH
Cc: Will Deacon, catalin.marinas, ard.biesheuvel, marc.zyngier,
james.morse, kristina.martsenko, steve.capper, tglx, mingo, hpa,
akpm, vbabka, mhocko, dave.hansen, dan.j.williams,
kirill.shutemov, zhang.jia, schwidefsky, heiko.carstens, gregkh,
linux-kernel, linux-arm-kernel, x86, linux-s390
Because CONFIG_STRICT_KERNEL_RWX=n cannot be set by make menuconfig on arm64/x86/s390 architecture
So, these three patches should not be necessary
Sorry to disturb everyone
Thank you for your guidance
Thanks
-----Original Message-----
From: Mark Rutland [mailto:mark.rutland@arm.com]
Sent: Wednesday, May 30, 2018 4:08 PM
To: Nixiaoming <nixiaoming@huawei.com>
Cc: Will Deacon <will.deacon@arm.com>; catalin.marinas@arm.com; ard.biesheuvel@linaro.org; marc.zyngier@arm.com; james.morse@arm.com; kristina.martsenko@arm.com; steve.capper@arm.com; tglx@linutronix.de; mingo@redhat.com; hpa@zytor.com; akpm@linux-foundation.org; vbabka@suse.cz; mhocko@suse.com; dave.hansen@linux.intel.com; dan.j.williams@intel.com; kirill.shutemov@linux.intel.com; zhang.jia@linux.alibaba.com; schwidefsky@de.ibm.com; heiko.carstens@de.ibm.com; gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; x86@kernel.org; linux-s390@vger.kernel.org
Subject: Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
On Wed, May 30, 2018 at 03:31:38AM +0000, Nixiaoming wrote:
> Unable to set CONFIG_STRICT_KERNEL_RWX=n by make menuconfig ARCH=arm64
Indeed. Making this mandatory was a deliberate decision, in part because this
allows simplification of code (e.g. removal of #ifdef guards).
> When reading the code, I feel it is more appropriate to add macro control
> here.
I must disagree. I do not think it makes sense to add an #ifdef for a
configuration option that is mandatory.
There are other places in the kernel that should behave differently if
CONFIG_STRICT_KERNEL_RWX were disabled, so this wouldn't be sufficient even if
we were to make CONFIG_STRICT_KERNEL_RWX optional. i.e. the #ifdef would give
the misleading impression that STRICT_KERNEL_RWX *could* be made optional, even
though this might not function correctly.
Having an #ifdef here makes the code more complicated and confusing, for the
benefit of a case which cannot occur.
Thanks,
Mark.
> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@arm.com]
> Sent: Tuesday, May 29, 2018 11:45 PM
> To: Nixiaoming <nixiaoming@huawei.com>
> Cc: catalin.marinas@arm.com; ard.biesheuvel@linaro.org; marc.zyngier@arm.com; james.morse@arm.com; kristina.martsenko@arm.com; steve.capper@arm.com; tglx@linutronix.de; mingo@redhat.com; hpa@zytor.com; akpm@linux-foundation.org; vbabka@suse.cz; mhocko@suse.com; dave.hansen@linux.intel.com; dan.j.williams@intel.com; kirill.shutemov@linux.intel.com; zhang.jia@linux.alibaba.com; schwidefsky@de.ibm.com; heiko.carstens@de.ibm.com; gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; x86@kernel.org; linux-s390@vger.kernel.org
> Subject: Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
>
> On Tue, May 29, 2018 at 09:36:15PM +0800, nixiaoming wrote:
> > mark_rodata_ro is only called by the function mark_readonly when
> > CONFIG_STRICT_KERNEL_RWX=y,
> > if CONFIG_STRICT_KERNEL_RWX is not set
> > a compile warning may be triggered: unused function
>
> How are you achieving this configuration? In our Kconfig we select this
> unconditionally.
>
> Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
2018-05-30 3:31 ` Nixiaoming
@ 2018-05-30 8:08 ` Mark Rutland
2018-05-30 9:05 ` Nixiaoming
0 siblings, 1 reply; 7+ messages in thread
From: Mark Rutland @ 2018-05-30 8:08 UTC (permalink / raw)
To: Nixiaoming
Cc: Will Deacon, catalin.marinas, ard.biesheuvel, marc.zyngier,
james.morse, kristina.martsenko, steve.capper, tglx, mingo, hpa,
akpm, vbabka, mhocko, dave.hansen, dan.j.williams,
kirill.shutemov, zhang.jia, schwidefsky, heiko.carstens, gregkh,
linux-kernel, linux-arm-kernel, x86, linux-s390
On Wed, May 30, 2018 at 03:31:38AM +0000, Nixiaoming wrote:
> Unable to set CONFIG_STRICT_KERNEL_RWX=n by make menuconfig ARCH=arm64
Indeed. Making this mandatory was a deliberate decision, in part because this
allows simplification of code (e.g. removal of #ifdef guards).
> When reading the code, I feel it is more appropriate to add macro control
> here.
I must disagree. I do not think it makes sense to add an #ifdef for a
configuration option that is mandatory.
There are other places in the kernel that should behave differently if
CONFIG_STRICT_KERNEL_RWX were disabled, so this wouldn't be sufficient even if
we were to make CONFIG_STRICT_KERNEL_RWX optional. i.e. the #ifdef would give
the misleading impression that STRICT_KERNEL_RWX *could* be made optional, even
though this might not function correctly.
Having an #ifdef here makes the code more complicated and confusing, for the
benefit of a case which cannot occur.
Thanks,
Mark.
> -----Original Message-----
> From: Will Deacon [mailto:will.deacon@arm.com]
> Sent: Tuesday, May 29, 2018 11:45 PM
> To: Nixiaoming <nixiaoming@huawei.com>
> Cc: catalin.marinas@arm.com; ard.biesheuvel@linaro.org; marc.zyngier@arm.com; james.morse@arm.com; kristina.martsenko@arm.com; steve.capper@arm.com; tglx@linutronix.de; mingo@redhat.com; hpa@zytor.com; akpm@linux-foundation.org; vbabka@suse.cz; mhocko@suse.com; dave.hansen@linux.intel.com; dan.j.williams@intel.com; kirill.shutemov@linux.intel.com; zhang.jia@linux.alibaba.com; schwidefsky@de.ibm.com; heiko.carstens@de.ibm.com; gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; x86@kernel.org; linux-s390@vger.kernel.org
> Subject: Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
>
> On Tue, May 29, 2018 at 09:36:15PM +0800, nixiaoming wrote:
> > mark_rodata_ro is only called by the function mark_readonly when
> > CONFIG_STRICT_KERNEL_RWX=y,
> > if CONFIG_STRICT_KERNEL_RWX is not set
> > a compile warning may be triggered: unused function
>
> How are you achieving this configuration? In our Kconfig we select this
> unconditionally.
>
> Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
2018-05-29 15:45 ` Will Deacon
@ 2018-05-30 3:31 ` Nixiaoming
2018-05-30 8:08 ` Mark Rutland
0 siblings, 1 reply; 7+ messages in thread
From: Nixiaoming @ 2018-05-30 3:31 UTC (permalink / raw)
To: Will Deacon
Cc: catalin.marinas, ard.biesheuvel, marc.zyngier, james.morse,
kristina.martsenko, steve.capper, tglx, mingo, hpa, akpm, vbabka,
mhocko, dave.hansen, dan.j.williams, kirill.shutemov, zhang.jia,
schwidefsky, heiko.carstens, gregkh, linux-kernel,
linux-arm-kernel, x86, linux-s390
Unable to set CONFIG_STRICT_KERNEL_RWX=n by make menuconfig ARCH=arm64
When reading the code, I feel it is more appropriate to add macro control here.
-----Original Message-----
From: Will Deacon [mailto:will.deacon@arm.com]
Sent: Tuesday, May 29, 2018 11:45 PM
To: Nixiaoming <nixiaoming@huawei.com>
Cc: catalin.marinas@arm.com; ard.biesheuvel@linaro.org; marc.zyngier@arm.com; james.morse@arm.com; kristina.martsenko@arm.com; steve.capper@arm.com; tglx@linutronix.de; mingo@redhat.com; hpa@zytor.com; akpm@linux-foundation.org; vbabka@suse.cz; mhocko@suse.com; dave.hansen@linux.intel.com; dan.j.williams@intel.com; kirill.shutemov@linux.intel.com; zhang.jia@linux.alibaba.com; schwidefsky@de.ibm.com; heiko.carstens@de.ibm.com; gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; x86@kernel.org; linux-s390@vger.kernel.org
Subject: Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
On Tue, May 29, 2018 at 09:36:15PM +0800, nixiaoming wrote:
> mark_rodata_ro is only called by the function mark_readonly when
> CONFIG_STRICT_KERNEL_RWX=y,
> if CONFIG_STRICT_KERNEL_RWX is not set
> a compile warning may be triggered: unused function
How are you achieving this configuration? In our Kconfig we select this
unconditionally.
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
2018-05-29 13:36 nixiaoming
@ 2018-05-29 15:45 ` Will Deacon
2018-05-30 3:31 ` Nixiaoming
0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2018-05-29 15:45 UTC (permalink / raw)
To: nixiaoming
Cc: catalin.marinas, ard.biesheuvel, marc.zyngier, james.morse,
kristina.martsenko, steve.capper, tglx, mingo, hpa, akpm, vbabka,
mhocko, dave.hansen, dan.j.williams, kirill.shutemov, zhang.jia,
schwidefsky, heiko.carstens, gregkh, linux-kernel,
linux-arm-kernel, x86, linux-s390
On Tue, May 29, 2018 at 09:36:15PM +0800, nixiaoming wrote:
> mark_rodata_ro is only called by the function mark_readonly when
> CONFIG_STRICT_KERNEL_RWX=y,
> if CONFIG_STRICT_KERNEL_RWX is not set
> a compile warning may be triggered: unused function
How are you achieving this configuration? In our Kconfig we select this
unconditionally.
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro
@ 2018-05-29 13:36 nixiaoming
2018-05-29 15:45 ` Will Deacon
0 siblings, 1 reply; 7+ messages in thread
From: nixiaoming @ 2018-05-29 13:36 UTC (permalink / raw)
To: catalin.marinas, will.deacon, ard.biesheuvel, marc.zyngier,
james.morse, kristina.martsenko, steve.capper, tglx, mingo, hpa,
akpm, vbabka, mhocko, dave.hansen, dan.j.williams,
kirill.shutemov, zhang.jia, schwidefsky, heiko.carstens, gregkh
Cc: nixiaoming, linux-kernel, linux-arm-kernel, x86, linux-s390
mark_rodata_ro is only called by the function mark_readonly when
CONFIG_STRICT_KERNEL_RWX=y,
if CONFIG_STRICT_KERNEL_RWX is not set
a compile warning may be triggered: unused function
Signed-off-by: nixiaoming <nixiaoming@huawei.com>
---
arch/arm64/mm/mmu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 2dbb2c9..849f326 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -491,6 +491,7 @@ static void __init map_mem(pgd_t *pgdp)
#endif
}
+#ifdef CONFIG_STRICT_KERNEL_RWX
void mark_rodata_ro(void)
{
unsigned long section_size;
@@ -505,6 +506,7 @@ void mark_rodata_ro(void)
debug_checkwx();
}
+#endif
static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end,
pgprot_t prot, struct vm_struct *vma,
--
2.10.1
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-30 9:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-28 3:33 [PATCH 1/3] arm64:add missing CONFIG_STRICT_KERNEL_RWX for mark_rodata_ro nixiaoming
2018-05-29 9:21 ` Will Deacon
2018-05-29 13:36 nixiaoming
2018-05-29 15:45 ` Will Deacon
2018-05-30 3:31 ` Nixiaoming
2018-05-30 8:08 ` Mark Rutland
2018-05-30 9:05 ` Nixiaoming
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).