Re: [PATCH v1] proc/vmcore: fix clearing user buffer by properly using clear_user()

2021-11-12 Thread David Hildenbrand
On 12.11.21 08:01, Baoquan He wrote: > On 11/11/21 at 08:18pm, David Hildenbrand wrote: >> To clear a user buffer we cannot simply use memset, we have to use >> clear_user(). Using a kernel config based on rawhide Fedora and a >> virtio-mem device that registers a vmcore_cb, I can easily trigger: >

Re: [PATCH v1] proc/vmcore: don't fake reading zeroes on surprise vmcore_cb unregistration

2021-11-12 Thread David Hildenbrand
On 12.11.21 04:30, Baoquan He wrote: > On 11/11/21 at 08:22pm, David Hildenbrand wrote: >> In commit cc5f2704c934 ("proc/vmcore: convert oldmem_pfn_is_ram callback >> to more generic vmcore callbacks"), we added detection of surprise >> vmcore_cb unregistration after the vmcore was already opened.

Re: [PATCH v1] proc/vmcore: don't fake reading zeroes on surprise vmcore_cb unregistration

2021-11-12 Thread Baoquan He
On 11/12/21 at 09:28am, David Hildenbrand wrote: > On 12.11.21 04:30, Baoquan He wrote: > > On 11/11/21 at 08:22pm, David Hildenbrand wrote: > >> In commit cc5f2704c934 ("proc/vmcore: convert oldmem_pfn_is_ram callback > >> to more generic vmcore callbacks"), we added detection of surprise > >> vmc

Re: [PATCH v1] proc/vmcore: fix clearing user buffer by properly using clear_user()

2021-11-12 Thread Baoquan He
On 11/12/21 at 09:16am, David Hildenbrand wrote: > On 12.11.21 08:01, Baoquan He wrote: > > On 11/11/21 at 08:18pm, David Hildenbrand wrote: > >> To clear a user buffer we cannot simply use memset, we have to use > >> clear_user(). Using a kernel config based on rawhide Fedora and a > >> virtio-mem

Re: [PATCH v1] proc/vmcore: fix clearing user buffer by properly using clear_user()

2021-11-12 Thread David Hildenbrand
> > "that allows supervisor mode programs to optionally set user-space > > memory mappings so that access to those mappings from supervisor mode > > will cause a trap. This makes it harder for malicious programs to > > "trick" the kernel into using instructions or data from a user-space > > program

[PATCH v2] proc/vmcore: fix clearing user buffer by properly using clear_user()

2021-11-12 Thread David Hildenbrand
To clear a user buffer we cannot simply use memset, we have to use clear_user(). With a virtio-mem device that registers a vmcore_cb and has some logically unplugged memory inside an added Linux memory block, I can easily trigger a BUG by copying the vmcore via "cp": [ 11.327580] systemd[1]: Sta

Re: [PATCH v1] proc/vmcore: fix clearing user buffer by properly using clear_user()

2021-11-12 Thread Baoquan He
On 11/12/21 at 10:08am, David Hildenbrand wrote: > > > "that allows supervisor mode programs to optionally set user-space > > > memory mappings so that access to those mappings from supervisor mode > > > will cause a trap. This makes it harder for malicious programs to > > > "trick" the kernel into

Re: [PATCH v2 08/12] x86/sev: Park APs on AP Jump Table with GHCB protocol version 2

2021-11-12 Thread Borislav Petkov
On Mon, Sep 13, 2021 at 05:55:59PM +0200, Joerg Roedel wrote: > From: Joerg Roedel > > GHCB protocol version 2 adds the MSR-based AP-reset-hold VMGEXIT which > does not need a GHCB. Use that to park APs in 16-bit protected mode on > the AP Jump Table. > > Signed-off-by: Joerg Roedel > --- > ar