From: Conor Dooley <conor.dooley@microchip.com> To: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Alexander Potapenko <glider@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Ard Biesheuvel <ardb@kernel.org>, Conor Dooley <conor@kernel.org>, <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <kasan-dev@googlegroups.com>, <linux-efi@vger.kernel.org> Subject: Re: [PATCH v3 3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space Date: Fri, 27 Jan 2023 15:27:40 +0000 [thread overview] Message-ID: <Y9PtbMSe9DUk3bCn@wendy> (raw) In-Reply-To: <20230125082333.1577572-4-alexghiti@rivosinc.com> [-- Attachment #1: Type: text/plain, Size: 1706 bytes --] Hey Alex, On Wed, Jan 25, 2023 at 09:23:30AM +0100, Alexandre Ghiti wrote: > The early virtual address should lie in the kernel address space for > inline kasan instrumentation to succeed, otherwise kasan tries to > dereference an address that does not exist in the address space (since > kasan only maps *kernel* address space, not the userspace). > > Simply use the very first address of the kernel address space for the > early fdt mapping. > > It allowed an Ubuntu kernel to boot successfully with inline > instrumentation. > > Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Been poking around in this area the last few days trying to hunt down some bugs... Things look functionally the same w/ this patch and we do get rid of the odd looking pointer which is nice. Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Probably would've made the cause of 50e63dd8ed92 ("riscv: fix reserved memory setup") more difficult to find so glad I got that out of the way well before this patch! Thanks, Conor. > --- > arch/riscv/mm/init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 478d6763a01a..87f6a5d475a6 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -57,7 +57,7 @@ unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] > EXPORT_SYMBOL(empty_zero_page); > > extern char _start[]; > -#define DTB_EARLY_BASE_VA PGDIR_SIZE > +#define DTB_EARLY_BASE_VA (ADDRESS_SPACE_END - (PTRS_PER_PGD / 2 * PGDIR_SIZE) + 1) > void *_dtb_early_va __initdata; > uintptr_t _dtb_early_pa __initdata; > > -- > 2.37.2 > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Conor Dooley <conor.dooley@microchip.com> To: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Alexander Potapenko <glider@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Ard Biesheuvel <ardb@kernel.org>, Conor Dooley <conor@kernel.org>, <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <kasan-dev@googlegroups.com>, <linux-efi@vger.kernel.org> Subject: Re: [PATCH v3 3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space Date: Fri, 27 Jan 2023 15:27:40 +0000 [thread overview] Message-ID: <Y9PtbMSe9DUk3bCn@wendy> (raw) In-Reply-To: <20230125082333.1577572-4-alexghiti@rivosinc.com> [-- Attachment #1.1: Type: text/plain, Size: 1706 bytes --] Hey Alex, On Wed, Jan 25, 2023 at 09:23:30AM +0100, Alexandre Ghiti wrote: > The early virtual address should lie in the kernel address space for > inline kasan instrumentation to succeed, otherwise kasan tries to > dereference an address that does not exist in the address space (since > kasan only maps *kernel* address space, not the userspace). > > Simply use the very first address of the kernel address space for the > early fdt mapping. > > It allowed an Ubuntu kernel to boot successfully with inline > instrumentation. > > Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Been poking around in this area the last few days trying to hunt down some bugs... Things look functionally the same w/ this patch and we do get rid of the odd looking pointer which is nice. Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Probably would've made the cause of 50e63dd8ed92 ("riscv: fix reserved memory setup") more difficult to find so glad I got that out of the way well before this patch! Thanks, Conor. > --- > arch/riscv/mm/init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 478d6763a01a..87f6a5d475a6 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -57,7 +57,7 @@ unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] > EXPORT_SYMBOL(empty_zero_page); > > extern char _start[]; > -#define DTB_EARLY_BASE_VA PGDIR_SIZE > +#define DTB_EARLY_BASE_VA (ADDRESS_SPACE_END - (PTRS_PER_PGD / 2 * PGDIR_SIZE) + 1) > void *_dtb_early_va __initdata; > uintptr_t _dtb_early_pa __initdata; > > -- > 2.37.2 > > [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 161 bytes --] _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-01-27 15:28 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-25 8:23 [PATCH v3 0/6] RISC-V kasan rework Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti 2023-01-25 8:23 ` [PATCH v3 1/6] riscv: Split early and final KASAN population functions Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti 2023-01-25 8:23 ` [PATCH v3 2/6] riscv: Rework kasan " Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti 2023-02-01 0:15 ` kernel test robot 2023-02-01 0:15 ` kernel test robot 2023-02-02 14:00 ` Alexandre Ghiti 2023-02-02 14:00 ` Alexandre Ghiti 2023-01-25 8:23 ` [PATCH v3 3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti 2023-01-27 15:27 ` Conor Dooley [this message] 2023-01-27 15:27 ` Conor Dooley 2023-01-25 8:23 ` [PATCH v3 4/6] riscv: Fix EFI stub usage of KASAN instrumented strcmp function Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti 2023-01-25 8:23 ` [PATCH v3 5/6] riscv: Fix ptdump when KASAN is enabled Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti 2023-01-25 8:23 ` [PATCH v3 6/6] riscv: Unconditionnally select KASAN_VMALLOC if KASAN Alexandre Ghiti 2023-01-25 8:23 ` Alexandre Ghiti
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=Y9PtbMSe9DUk3bCn@wendy \ --to=conor.dooley@microchip.com \ --cc=alexghiti@rivosinc.com \ --cc=andreyknvl@gmail.com \ --cc=aou@eecs.berkeley.edu \ --cc=ardb@kernel.org \ --cc=conor@kernel.org \ --cc=dvyukov@google.com \ --cc=glider@google.com \ --cc=kasan-dev@googlegroups.com \ --cc=linux-efi@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ --cc=ryabinin.a.a@gmail.com \ --cc=vincenzo.frascino@arm.com \ /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.