Re: [PATCH v15 7/9] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-08-13 Thread Jordan Niethe
On Sat, Aug 14, 2021 at 8:59 AM Fabiano Rosas wrote: > > Laurent Vivier writes: > > > > > since this patch is merged my VM is experiencing a crash at boot (20% of > > the time): > > > > [8.496850] kernel tried to execute exec-protected page > > (c00804073278) - exploit > > attempt?

Re: [PATCH] ppc: add "-z notext" flag to disable diagnostic

2021-08-13 Thread Fangrui Song
On 2021-08-14, Daniel Axtens wrote: Bill Wendling writes: The "-z notext" flag disables reporting an error if DT_TEXTREL is set on PPC with CONFIG=kdump: ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64 against local symbol in readonly segment; recompile object files with

[PATCH v2] ppc: add "-z notext" flag to disable diagnostic

2021-08-13 Thread Bill Wendling
From: Fangrui Song Object files used to link .tmp_vmlinux.kallsyms1 have many R_PPC64_ADDR64 relocations in non-SHF_WRITE sections. There are many text relocations (e.g. in .rela___ksymtab_gpl+* and .rela__mcount_loc sections) in a -pie link and are disallowed by LLD: ld.lld: error: can't

Re: [PATCH] ppc: add "-z notext" flag to disable diagnostic

2021-08-13 Thread Nick Desaulniers
On Fri, Aug 13, 2021 at 11:24 AM Bill Wendling wrote: > > BTW, this patch should more properly be attributed to Fangrui Song. I > can send a follow-up patch that reflects this and adds more context to > the commit message. Sounds good to me. The TL;DR is that LLD has a different implicit default

Re: [PATCH v15 7/9] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-08-13 Thread Fabiano Rosas
Laurent Vivier writes: > > since this patch is merged my VM is experiencing a crash at boot (20% of the > time): > > [8.496850] kernel tried to execute exec-protected page (c00804073278) > - exploit > attempt? (uid: 0) > [8.496921] BUG: Unable to handle kernel instruction fetch > [

Re: [PATCH] ppc: add "-z notext" flag to disable diagnostic

2021-08-13 Thread Bill Wendling
On Fri, Aug 13, 2021 at 7:13 AM Daniel Axtens wrote: > > Bill Wendling writes: > > > The "-z notext" flag disables reporting an error if DT_TEXTREL is set on > > PPC with CONFIG=kdump: > > > > ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64 against > > local symbol in

Re: [PATCH] soc: fsl: qe: fix static checker warning

2021-08-13 Thread Li Yang
On Wed, Aug 11, 2021 at 2:10 AM Maxim Kochetkov wrote: > > The patch be7ecbd240b2: "soc: fsl: qe: convert QE interrupt > controller to platform_device" from Aug 3, 2021, leads to the > following static checker warning: > > drivers/soc/fsl/qe/qe_ic.c:438 qe_ic_init() > warn:

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-13 Thread Tom Lendacky
On 8/13/21 12:08 PM, Tom Lendacky wrote: On 8/12/21 5:07 AM, Kirill A. Shutemov wrote: On Wed, Aug 11, 2021 at 10:52:55AM -0500, Tom Lendacky wrote: On 8/11/21 7:19 AM, Kirill A. Shutemov wrote: On Tue, Aug 10, 2021 at 02:48:54PM -0500, Tom Lendacky wrote: On 8/10/21 1:45 PM, Kuppuswamy,

Re: [PATCH v2 00/12] Implement generic prot_guest_has() helper function

2021-08-13 Thread Tom Lendacky
On 8/13/21 11:59 AM, Tom Lendacky wrote: This patch series provides a generic helper function, prot_guest_has(), to replace the sme_active(), sev_active(), sev_es_active() and mem_encrypt_active() functions. It is expected that as new protected virtualization technologies are added to the

Re: [PATCH v2 02/12] mm: Introduce a function to check for virtualization protection features

2021-08-13 Thread Kuppuswamy, Sathyanarayanan
On 8/13/21 9:59 AM, Tom Lendacky wrote: In prep for other protected virtualization technologies, introduce a generic helper function, prot_guest_has(), that can be used to check for specific protection attributes, like memory encryption. This is intended to eliminate having to add multiple

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-13 Thread Tom Lendacky
On 8/12/21 5:07 AM, Kirill A. Shutemov wrote: On Wed, Aug 11, 2021 at 10:52:55AM -0500, Tom Lendacky wrote: On 8/11/21 7:19 AM, Kirill A. Shutemov wrote: On Tue, Aug 10, 2021 at 02:48:54PM -0500, Tom Lendacky wrote: On 8/10/21 1:45 PM, Kuppuswamy, Sathyanarayanan wrote: ... Looking at code

[PATCH v2 12/12] s390/mm: Remove the now unused mem_encrypt_active() function

2021-08-13 Thread Tom Lendacky
The mem_encrypt_active() function has been replaced by prot_guest_has(), so remove the implementation. Since the default implementation of the prot_guest_has() matches the s390 implementation of mem_encrypt_active(), prot_guest_has() does not need to be implemented in s390 (the config option

[PATCH v2 11/12] powerpc/pseries/svm: Remove the now unused mem_encrypt_active() function

2021-08-13 Thread Tom Lendacky
The mem_encrypt_active() function has been replaced by prot_guest_has(), so remove the implementation. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Signed-off-by: Tom Lendacky --- arch/powerpc/include/asm/mem_encrypt.h | 5 - 1 file changed, 5 deletions(-) diff

[PATCH v2 09/12] mm: Remove the now unused mem_encrypt_active() function

2021-08-13 Thread Tom Lendacky
The mem_encrypt_active() function has been replaced by prot_guest_has(), so remove the implementation. Reviewed-by: Joerg Roedel Signed-off-by: Tom Lendacky --- include/linux/mem_encrypt.h | 4 1 file changed, 4 deletions(-) diff --git a/include/linux/mem_encrypt.h

[PATCH v2 10/12] x86/sev: Remove the now unused mem_encrypt_active() function

2021-08-13 Thread Tom Lendacky
The mem_encrypt_active() function has been replaced by prot_guest_has(), so remove the implementation. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Reviewed-by: Joerg Roedel Signed-off-by: Tom Lendacky --- arch/x86/include/asm/mem_encrypt.h | 5 - 1 file changed, 5

[PATCH v2 08/12] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-13 Thread Tom Lendacky
Replace occurrences of mem_encrypt_active() with calls to prot_guest_has() with the PATTR_MEM_ENCRYPT attribute. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc:

[PATCH v2 07/12] x86/sev: Replace occurrences of sev_es_active() with prot_guest_has()

2021-08-13 Thread Tom Lendacky
Replace occurrences of sev_es_active() with the more generic prot_guest_has() using PATTR_GUEST_PROT_STATE, except for in arch/x86/kernel/sev*.c and arch/x86/mm/mem_encrypt*.c where PATTR_SEV_ES will be used. If future support is added for other memory encyrption techonologies, the use of

[PATCH v2 06/12] x86/sev: Replace occurrences of sev_active() with prot_guest_has()

2021-08-13 Thread Tom Lendacky
Replace occurrences of sev_active() with the more generic prot_guest_has() using PATTR_GUEST_MEM_ENCRYPT, except for in arch/x86/mm/mem_encrypt*.c where PATTR_SEV will be used. If future support is added for other memory encryption technologies, the use of PATTR_GUEST_MEM_ENCRYPT can be updated,

[PATCH v2 05/12] x86/sme: Replace occurrences of sme_active() with prot_guest_has()

2021-08-13 Thread Tom Lendacky
Replace occurrences of sme_active() with the more generic prot_guest_has() using PATTR_HOST_MEM_ENCRYPT, except for in arch/x86/mm/mem_encrypt*.c where PATTR_SME will be used. If future support is added for other memory encryption technologies, the use of PATTR_HOST_MEM_ENCRYPT can be updated, as

[PATCH v2 04/12] powerpc/pseries/svm: Add a powerpc version of prot_guest_has()

2021-08-13 Thread Tom Lendacky
Introduce a powerpc version of the prot_guest_has() function. This will be used to replace the powerpc mem_encrypt_active() implementation, so the implementation will initially only support the PATTR_MEM_ENCRYPT attribute. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras

[PATCH v2 03/12] x86/sev: Add an x86 version of prot_guest_has()

2021-08-13 Thread Tom Lendacky
Introduce an x86 version of the prot_guest_has() function. This will be used in the more generic x86 code to replace vendor specific calls like sev_active(), etc. While the name suggests this is intended mainly for guests, it will also be used for host memory encryption checks in place of

[PATCH v2 02/12] mm: Introduce a function to check for virtualization protection features

2021-08-13 Thread Tom Lendacky
In prep for other protected virtualization technologies, introduce a generic helper function, prot_guest_has(), that can be used to check for specific protection attributes, like memory encryption. This is intended to eliminate having to add multiple technology-specific checks to the code (e.g. if

[PATCH v2 01/12] x86/ioremap: Selectively build arch override encryption functions

2021-08-13 Thread Tom Lendacky
In prep for other uses of the prot_guest_has() function besides AMD's memory encryption support, selectively build the AMD memory encryption architecture override functions only when CONFIG_AMD_MEM_ENCRYPT=y. These functions are: - early_memremap_pgprot_adjust() - arch_memremap_can_ram_remap()

[PATCH v2 00/12] Implement generic prot_guest_has() helper function

2021-08-13 Thread Tom Lendacky
This patch series provides a generic helper function, prot_guest_has(), to replace the sme_active(), sev_active(), sev_es_active() and mem_encrypt_active() functions. It is expected that as new protected virtualization technologies are added to the kernel, they can all be covered by a single

Re: [PATCH] powerpc/svm: Don't issue ultracalls if !mem_encrypt_active()

2021-08-13 Thread Borislav Petkov
On Mon, Aug 02, 2021 at 09:20:30PM +1000, Michael Ellerman wrote: > Will Deacon writes: > > Commit ad6c00283163 ("swiotlb: Free tbl memory in swiotlb_exit()") > > introduced a set_memory_encrypted() call to swiotlb_exit() so that the > > buffer pages are returned to an encrypted state prior to

Re: [PATCH v6 1/2] tty: hvc: pass DMA capable memory to put_chars()

2021-08-13 Thread Xianting TIan
在 2021/8/13 下午1:53, Jiri Slaby 写道: Hi, On 12. 08. 21, 14:26, kernel test robot wrote: drivers/tty/hvc/hvc_console.c:190:26: warning: variable 'hp' is uninitialized when used here [-Wuninitialized]     spin_unlock_irqrestore(>c_lock, flags);     ^~    

Re: [PATCH] ppc: add "-z notext" flag to disable diagnostic

2021-08-13 Thread Daniel Axtens
Bill Wendling writes: > The "-z notext" flag disables reporting an error if DT_TEXTREL is set on > PPC with CONFIG=kdump: > > ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64 against > local symbol in readonly segment; recompile object files with -fPIC > or pass

Re: [PATCH v2] powerpc/xive: Do not skip CPU-less nodes when creating the IPIs

2021-08-13 Thread Michael Ellerman
On Sat, 7 Aug 2021 09:20:57 +0200, Cédric Le Goater wrote: > On PowerVM, CPU-less nodes can be populated with hot-plugged CPUs at > runtime. Today, the IPI is not created for such nodes, and hot-plugged > CPUs use a bogus IPI, which leads to soft lockups. > > We can not directly allocate and

Re: [PATCH v2] powerpc/kprobes: Fix kprobe Oops happens in booke

2021-08-13 Thread Michael Ellerman
On Mon, 9 Aug 2021 10:36:58 +0800, Pu Lehui wrote: > When using kprobe on powerpc booke series processor, Oops happens > as show bellow: > > / # echo "p:myprobe do_nanosleep" > /sys/kernel/debug/tracing/kprobe_events > / # echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe/enable > / #

Re: [PATCH] powerpc/pseries: Fix update of LPAR security flavor after LPM

2021-08-13 Thread Michael Ellerman
On Thu, 5 Aug 2021 17:23:08 +0200, Laurent Dufour wrote: > After LPM, when migrating from a system with security mitigation enabled to > a system with mitigation disabled, the security flavor exposed in /proc is > not correctly set back to 0. > > Do not assume the value of the security flavor is

Re: [PATCH] powerpc/smp: Fix OOPS in topology_init()

2021-08-13 Thread Michael Ellerman
On Wed, 4 Aug 2021 18:24:10 + (UTC), Christophe Leroy wrote: > Running an SMP kernel on an UP platform not prepared for it, > I encountered the following OOPS: > > BUG: Kernel NULL pointer dereference on read at 0x0034 > Faulting instruction address: 0xc0a04110 > Oops:

Re: [PATCH] powerpc/32s: Fix napping restore in data storage interrupt (DSI)

2021-08-13 Thread Michael Ellerman
On Tue, 3 Aug 2021 15:14:27 + (UTC), Christophe Leroy wrote: > When a DSI (Data Storage Interrupt) is taken while in NAP mode, > r11 doesn't survive the call to power_save_ppc32_restore(). > > So use r1 instead of r11 as they both contain the virtual stack > pointer at that point. Applied to

Re: [PATCH] powerpc/32: Fix critical and debug interrupts on BOOKE

2021-08-13 Thread Michael Ellerman
On Wed, 7 Jul 2021 05:55:07 + (UTC), Christophe Leroy wrote: > 32 bits BOOKE have special interrupts for debug and other > critical events. > > When handling those interrupts, dedicated registers are saved > in the stack frame in addition to the standard registers, leading > to a shift of the

Re: [PATCH] powerpc/interrupt: Fix OOPS by not calling do_IRQ() from timer_interrupt()

2021-08-13 Thread Michael Ellerman
On Tue, 10 Aug 2021 16:13:16 + (UTC), Christophe Leroy wrote: > An interrupt handler shall not be called from another interrupt > handler otherwise this leads to problems like the following: > > Kernel attempted to write user page (afd4fa84) - exploit attempt? (uid: > 1000) >

Re: [PATCH] powerpc/interrupt: Do not call single_step_exception() from other exceptions

2021-08-13 Thread Michael Ellerman
On Tue, 10 Aug 2021 16:13:17 + (UTC), Christophe Leroy wrote: > single_step_exception() is called by emulate_single_step() which > is called from (at least) alignment exception() handler and > program_check_exception() handler. > > Redefine it as a regular __single_step_exception() which is

Re: [PATCH v6 1/2] tty: hvc: pass DMA capable memory to put_chars()

2021-08-13 Thread Xianting TIan
在 2021/8/13 下午3:27, Greg KH 写道: On Thu, Aug 12, 2021 at 05:45:31PM +0800, Xianting Tian wrote: As well known, hvc backend can register its opertions to hvc backend. the opertions contain put_chars(), get_chars() and so on. Some hvc backend may do dma in its opertions. eg, put_chars() of

Re: [PATCH kernel] KVM: PPC: Book3S HV: Make unique debugfs nodename

2021-08-13 Thread Alexey Kardashevskiy
On 07/07/2021 14:13, Alexey Kardashevskiy wrote: Currently it is vm-$currentpid which works as long as there is just one VM per the userspace (99.99% cases) but produces a bunch of "debugfs: Directory 'vm16679' with parent 'kvm' already present!" when syzkaller (syscall fuzzer) is running so

Re: [PATCH v2 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0

2021-08-13 Thread Christophe Leroy
Le 13/08/2021 à 10:24, Kajol Jain a écrit : Incase of random sampling, there can be scenarios where SIAR is not latching sample address and results in 0 value. Since current code directly returning the siar value, we could see multiple instruction pointer values as 0 in perf report. Patch

Re: [PATCH v2 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0

2021-08-13 Thread Christophe Leroy
Le 13/08/2021 à 10:24, Kajol Jain a écrit : Incase of random sampling, there can be scenarios where SIAR is not latching sample address and results in 0 value. Since current code directly returning the siar value, we could see multiple instruction pointer values as 0 in perf report. Patch

Re: [PATCH v2 1/2] powerpc/perf: Use stack siar instead of mfspr

2021-08-13 Thread Christophe Leroy
Le 13/08/2021 à 10:29, kajoljain a écrit : On 8/13/21 1:54 PM, Kajol Jain wrote: Minor optimization in the 'perf_instruction_pointer' function code by making use of stack siar instead of mfspr. Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs into perf_read_regs")

[PATCH 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0

2021-08-13 Thread Kajol Jain
Incase of random sampling, there can be scenarios where SIAR is not latching sample address and results in 0 value. Since current code directly returning the siar value, we could see multiple instruction pointer values as 0 in perf report. Patch resolves this issue by adding a ternary condition to

[PATCH 1/2] powerpc/perf: Use stack siar instead of mfspr

2021-08-13 Thread Kajol Jain
Minor optimization in the 'perf_instruction_pointer' function code by making use of stack siar instead of mfspr. Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs into perf_read_regs") Signed-off-by: Kajol Jain --- arch/powerpc/perf/core-book3s.c | 2 +- 1 file changed, 1

Re: [PATCH v2 1/2] powerpc/perf: Use stack siar instead of mfspr

2021-08-13 Thread kajoljain
On 8/13/21 1:54 PM, Kajol Jain wrote: > Minor optimization in the 'perf_instruction_pointer' function code by > making use of stack siar instead of mfspr. > > Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs > into perf_read_regs") > Signed-off-by: Kajol Jain Please

[PATCH v2 2/2] powerpc/perf: Return regs->nip as instruction pointer value when SIAR is 0

2021-08-13 Thread Kajol Jain
Incase of random sampling, there can be scenarios where SIAR is not latching sample address and results in 0 value. Since current code directly returning the siar value, we could see multiple instruction pointer values as 0 in perf report. Patch resolves this issue by adding a ternary condition to

[PATCH v2 1/2] powerpc/perf: Use stack siar instead of mfspr

2021-08-13 Thread Kajol Jain
Minor optimization in the 'perf_instruction_pointer' function code by making use of stack siar instead of mfspr. Fixes: 75382aa72f06 ("powerpc/perf: Move code to select SIAR or pt_regs into perf_read_regs") Signed-off-by: Kajol Jain --- arch/powerpc/perf/core-book3s.c | 2 +- 1 file changed, 1

[PATCH] powerpc/perf/hv-gpci: Fix the logic to compute counter value from the hcall result buffer.

2021-08-13 Thread Kajol Jain
H_GetPerformanceCounterInfo (0xF080) hcall returns the counter data in the result buffer. Result buffer has specific format defined in the PAPR specification. One of the field is counter offset and width of the counter data returned. Counter data are returned in a unsigned char array. To get the

Re: [PATCH v2 1/2] powerpc/book3s64/radix: make tlb_single_page_flush_ceiling a debugfs entry

2021-08-13 Thread Daniel Axtens
"Aneesh Kumar K.V" writes: > Similar to x86/s390 add a debugfs file to tune tlb_single_page_flush_ceiling. > Also add a debugfs entry for tlb_local_single_page_flush_ceiling. > > Signed-off-by: Aneesh Kumar K.V > --- > Changes from v1: > * switch to debugfs_create_u32 > >

Re: [PATCH v6 1/2] tty: hvc: pass DMA capable memory to put_chars()

2021-08-13 Thread Greg KH
On Thu, Aug 12, 2021 at 05:45:31PM +0800, Xianting Tian wrote: > As well known, hvc backend can register its opertions to hvc backend. > the opertions contain put_chars(), get_chars() and so on. > > Some hvc backend may do dma in its opertions. eg, put_chars() of > virtio-console. But in the code

Re: [PATCH v2 2/2] powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto

2021-08-13 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of April 14, 2021 2:38 am: > Using asm goto in __WARN_FLAGS() and WARN_ON() allows more > flexibility to GCC. > > For that add an entry to the exception table so that > program_check_exception() knowns where to resume execution > after a WARNING. Nice

Re: [PATCH v2 1/2] powerpc/bug: Remove specific powerpc BUG_ON() and WARN_ON() on PPC32

2021-08-13 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of April 14, 2021 2:38 am: > powerpc BUG_ON() and WARN_ON() are based on using twnei instruction. > > For catching simple conditions like a variable having value 0, this > is efficient because it does the test and the trap at the same time. > But most

Re: [PATCH v6 1/2] tty: hvc: pass DMA capable memory to put_chars()

2021-08-13 Thread Xianting TIan
在 2021/8/13 下午1:53, Jiri Slaby 写道: Hi, On 12. 08. 21, 14:26, kernel test robot wrote: drivers/tty/hvc/hvc_console.c:190:26: warning: variable 'hp' is uninitialized when used here [-Wuninitialized]     spin_unlock_irqrestore(>c_lock, flags);     ^~