Re: linux v5.18.3 fails to boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-06-10 12:49 p.m., John David Anglin wrote:
The commit was added to prevent compiler optimisation from splitting
read/write operations.  I think it can lead in a change in opcodes but
must be safe.  So I'm not sure why the commit causes boot failure for now.
Neither am I.

I'm not familiar with PARISC and this may be a stupid question though,
what does `ldd` exactly do? and which line is it executed in the func/file?
ldd performs a 64-bit load to register rp (r2).  It is part of mpt_reply's epilogue.
The prior "sync" instruction corresponds to the "mb()" at the end of mpt_reply.

I would have thought this code should have been write protected.  It seems
CONFIG_STRICT_MODULE_RWX is not explicitly set in config:

CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
CONFIG_STRICT_KERNEL_RWX=y

I think I need to try enabling CONFIG_STRICT_MODULE_RWX.
With CONFIG_STRICT_MODULE_RWX, the fault went away and the system boots normally.

To enable CONFIG_STRICT_MODULE_RWX, I needed to add attached patch to Kconfig.

As far as I can tell, this only affects patch_map in the parisc backend:

static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags,
                                 int *need_unmap)
{
        unsigned long uintaddr = (uintptr_t) addr;
        bool module = !core_kernel_text(uintaddr);
        struct page *page;

        *need_unmap = 0;
        if (module && IS_ENABLED(CONFIG_STRICT_MODULE_RWX))
                page = vmalloc_to_page(addr);
        else if (!module && IS_ENABLED(CONFIG_STRICT_KERNEL_RWX))
                page = virt_to_page(addr);
        else
                return addr;

Possibly, this might affect Fusion MPT base driver but no patches are applied:

[   29.971295] mptbase alternatives: applied 0 out of 3 patches
[   29.971295] Fusion MPT base driver 3.04.20
[   29.971295] Copyright (c) 1999-2008 LSI Corporation
[   29.971295] Fusion MPT SPI Host driver 3.04.20

Dave

--
John David Anglin  dave.anglin@xxxxxxxx
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index bd22578859d0..f3a2044ee402 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -10,6 +10,7 @@ config PARISC
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_STRICT_KERNEL_RWX
+	select ARCH_HAS_STRICT_MODULE_RWX
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_NO_SG_CHAIN

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux