lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXESRP9RvhPC5Wgg38BqyCn5ANv7+X9Ezyx5MXNNvEZ1kA@mail.gmail.com>
Date:   Mon, 7 Nov 2022 17:00:52 +0100
From:   Ard Biesheuvel <ardb@...nel.org>
To:     "zhaowenhui (A)" <zhaowenhui8@...wei.com>
Cc:     Arnd Bergmann <arnd@...db.de>, Kees Cook <keescook@...omium.org>,
        Nathan Chancellor <nathan@...nel.org>,
        "open list:GENERIC INCLUDE/ASM HEADER FILES" 
        <linux-arch@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>, xiafukun@...wei.com,
        yusongping@...wei.com
Subject: Re: vmlinux.lds.h: Bug report: unable to handle page fault when start
 the virtual machine with qemu

On Mon, 7 Nov 2022 at 04:27, zhaowenhui (A) <zhaowenhui8@...wei.com> wrote:
>
> Hello,
>
> We compiled the kernel with x86_64_defconfig and the following configs
> from commit  d4c6399900364facd84c9e35ce1540b6046c345f (vmlinux.lds.h:
> Avoid orphan section with !SMP ):
>
> CONFIG_SMP=n
> CONFIG_AMD_MEM_ENCRYPT=y
> CONFIG_HYPERVISOR_GUEST=y
> CONFIG_KVM=y
> CONFIG_PARAVIRT=y
>
> Then start virtual machine with the following command (OS: Ubuntu; Arch:
> x86-64):
>
> qemu-system-x86_64  -enable-kvm -cpu Skylake-Server -smp 10 -m 8192
> -boot menu=on,splash-time=1000 \
> -device virtio-scsi-pci \
> -initrd ${initramfs} \
> -kernel ./linux/arch/x86/boot/bzImage \
> -append "root=/dev/ram rw rdinit=/sbin/init console=tty0
> console=ttyS0,115200 earlyprintk=ttyS0 debug " \
> -nographic -vnc :18
>
> (Note:  ./linux/arch/x86/boot/bzImage  is the compiled kernel bzImage path
> On my machine,  initramfs=./x86_procfs.cpio.gz_1 )
>
> QEMU reports an error:  BUG: unable to handle page fault for address:
> ffffffff8ad01040
>
> The bug was introduced by commit d4c6399900, and the problem can be
> avoided by rolling back the patch.
> Patch link:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d4c6399900364facd84c9e35ce1540b6046c345f.
> We speculate that the problem is related to the hardware memory
> encryption feature in the virtualization scenario of the AMD platform.
>

That patch looks incorrect to me. Without CONFIG_SMP, the PERCPU
sections are not instantiated, and the only copy of those variables is
created in the ordinary .data/.bss sections

Does the change below fix the issue for you?

--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -347,6 +347,7 @@
 #define DATA_DATA                                                      \
        *(.xiptext)                                                     \
        *(DATA_MAIN)                                                    \
+       *(.data..decrypted)                                             \
        *(.ref.data)                                                    \
        *(.data..shared_aligned) /* percpu related */                   \
        MEM_KEEP(init.data*)                                            \
@@ -995,7 +996,6 @@
 #ifdef CONFIG_AMD_MEM_ENCRYPT
 #define PERCPU_DECRYPTED_SECTION                                       \
        . = ALIGN(PAGE_SIZE);                                           \
-       *(.data..decrypted)                                             \
        *(.data..percpu..decrypted)                                     \
        . = ALIGN(PAGE_SIZE);
 #else

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ