From: Kees Cook <keescook@chromium.org> To: Vineet Gupta <Vineet.Gupta1@synopsys.com> Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Evgeniy Didin <Evgeniy.Didin@synopsys.com> Subject: Re: [PATCH] ARC: fix CONFIG_HARDENED_USERCOPY Date: Thu, 10 Jun 2021 10:02:12 -0700 [thread overview] Message-ID: <202106101001.C736237@keescook> (raw) In-Reply-To: <20210609221211.2457203-1-vgupta@synopsys.com> On Wed, Jun 09, 2021 at 03:12:11PM -0700, Vineet Gupta wrote: > Currently enabling this triggers a warning > > | usercopy: Kernel memory overwrite attempt detected to kernel text (offset 155633, size 11)! > | usercopy: BUG: failure at mm/usercopy.c:99/usercopy_abort()! > | > |gcc generated __builtin_trap > |Path: /bin/busybox > |CPU: 0 PID: 84 Comm: init Not tainted 5.4.22 > | > |[ECR ]: 0x00090005 => gcc generated __builtin_trap > |[EFA ]: 0x9024fcaa > |[BLINK ]: usercopy_abort+0x8a/0x8c > |[ERET ]: memfd_fcntl+0x0/0x470 > |[STAT32]: 0x80080802 : IE K > |BTA: 0x901ba38c SP: 0xbe161ecc FP: 0xbf9fe950 > |LPS: 0x90677408 LPE: 0x9067740c LPC: 0x00000000 > |r00: 0x0000003c r01: 0xbf0ed280 r02: 0x00000000 > |r03: 0xbe15fa30 r04: 0x00d2803e r05: 0x00000000 > |r06: 0x675d7000 r07: 0x00000000 r08: 0x675d9c00 > |r09: 0x00000000 r10: 0x0000035c r11: 0x61206572 > |r12: 0x9024fcaa r13: 0x0000000b r14: 0x0000000b > |r15: 0x00000000 r16: 0x90169ffc r17: 0x90168000 > |r18: 0x00000000 r19: 0xbf092010 r20: 0x00000001 > |r21: 0x00000011 r22: 0x5ffffff1 r23: 0x90169ff1 > |r24: 0xbe196c00 r25: 0xbf0ed280 > | > |Stack Trace: > | memfd_fcntl+0x0/0x470 > | usercopy_abort+0x8a/0x8c > | __check_object_size+0x10e/0x138 > | copy_strings+0x1f4/0x38c > | __do_execve_file+0x352/0x848 > | EV_Trap+0xcc/0xd0 What was the root cause here? Was it that the init section gets freed and reused for kmalloc? > > Fixes: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/15 > Reported-by: Evgeniy Didin <didin@synopsys.com> > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> > --- > arch/arc/kernel/vmlinux.lds.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S > index 33ce59d91461..e2146a8da195 100644 > --- a/arch/arc/kernel/vmlinux.lds.S > +++ b/arch/arc/kernel/vmlinux.lds.S > @@ -57,7 +57,6 @@ SECTIONS > .init.ramfs : { INIT_RAM_FS } > > . = ALIGN(PAGE_SIZE); > - _stext = .; > > HEAD_TEXT_SECTION > INIT_TEXT_SECTION(L1_CACHE_BYTES) > @@ -83,6 +82,7 @@ SECTIONS > > .text : { > _text = .; > + _stext = .; > TEXT_TEXT > SCHED_TEXT > CPUIDLE_TEXT > -- > 2.25.1 > -- Kees Cook
WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org> To: Vineet Gupta <Vineet.Gupta1@synopsys.com> Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, Evgeniy Didin <Evgeniy.Didin@synopsys.com> Subject: Re: [PATCH] ARC: fix CONFIG_HARDENED_USERCOPY Date: Thu, 10 Jun 2021 10:02:12 -0700 [thread overview] Message-ID: <202106101001.C736237@keescook> (raw) In-Reply-To: <20210609221211.2457203-1-vgupta@synopsys.com> On Wed, Jun 09, 2021 at 03:12:11PM -0700, Vineet Gupta wrote: > Currently enabling this triggers a warning > > | usercopy: Kernel memory overwrite attempt detected to kernel text (offset 155633, size 11)! > | usercopy: BUG: failure at mm/usercopy.c:99/usercopy_abort()! > | > |gcc generated __builtin_trap > |Path: /bin/busybox > |CPU: 0 PID: 84 Comm: init Not tainted 5.4.22 > | > |[ECR ]: 0x00090005 => gcc generated __builtin_trap > |[EFA ]: 0x9024fcaa > |[BLINK ]: usercopy_abort+0x8a/0x8c > |[ERET ]: memfd_fcntl+0x0/0x470 > |[STAT32]: 0x80080802 : IE K > |BTA: 0x901ba38c SP: 0xbe161ecc FP: 0xbf9fe950 > |LPS: 0x90677408 LPE: 0x9067740c LPC: 0x00000000 > |r00: 0x0000003c r01: 0xbf0ed280 r02: 0x00000000 > |r03: 0xbe15fa30 r04: 0x00d2803e r05: 0x00000000 > |r06: 0x675d7000 r07: 0x00000000 r08: 0x675d9c00 > |r09: 0x00000000 r10: 0x0000035c r11: 0x61206572 > |r12: 0x9024fcaa r13: 0x0000000b r14: 0x0000000b > |r15: 0x00000000 r16: 0x90169ffc r17: 0x90168000 > |r18: 0x00000000 r19: 0xbf092010 r20: 0x00000001 > |r21: 0x00000011 r22: 0x5ffffff1 r23: 0x90169ff1 > |r24: 0xbe196c00 r25: 0xbf0ed280 > | > |Stack Trace: > | memfd_fcntl+0x0/0x470 > | usercopy_abort+0x8a/0x8c > | __check_object_size+0x10e/0x138 > | copy_strings+0x1f4/0x38c > | __do_execve_file+0x352/0x848 > | EV_Trap+0xcc/0xd0 What was the root cause here? Was it that the init section gets freed and reused for kmalloc? > > Fixes: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/15 > Reported-by: Evgeniy Didin <didin@synopsys.com> > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> > --- > arch/arc/kernel/vmlinux.lds.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S > index 33ce59d91461..e2146a8da195 100644 > --- a/arch/arc/kernel/vmlinux.lds.S > +++ b/arch/arc/kernel/vmlinux.lds.S > @@ -57,7 +57,6 @@ SECTIONS > .init.ramfs : { INIT_RAM_FS } > > . = ALIGN(PAGE_SIZE); > - _stext = .; > > HEAD_TEXT_SECTION > INIT_TEXT_SECTION(L1_CACHE_BYTES) > @@ -83,6 +82,7 @@ SECTIONS > > .text : { > _text = .; > + _stext = .; > TEXT_TEXT > SCHED_TEXT > CPUIDLE_TEXT > -- > 2.25.1 > -- Kees Cook _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
next prev parent reply other threads:[~2021-06-10 17:02 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-09 22:12 [PATCH] ARC: fix CONFIG_HARDENED_USERCOPY Vineet Gupta 2021-06-09 22:12 ` Vineet Gupta 2021-06-10 17:02 ` Kees Cook [this message] 2021-06-10 17:02 ` Kees Cook 2021-06-10 18:56 ` Vineet Gupta 2021-06-10 18:56 ` Vineet Gupta 2021-06-10 23:56 ` Kees Cook 2021-06-10 23:56 ` Kees Cook 2021-06-11 0:29 ` Vineet Gupta 2021-06-11 0:29 ` Vineet Gupta
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=202106101001.C736237@keescook \ --to=keescook@chromium.org \ --cc=Evgeniy.Didin@synopsys.com \ --cc=Vineet.Gupta1@synopsys.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-snps-arc@lists.infradead.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.