Re: [PATCH v2] mm, hwpoison: Try to recover from copy-on write faults

2022-10-23 Thread Shuai Xue
在 2022/10/22 AM12:30, Luck, Tony 写道: >>> But maybe it is some RMW instruction ... then, if all the above options >>> didn't happen ... we >>> could get another machine check from the same address. But then we just >>> follow the usual >>> recovery path. > > >> Let assume the instruction that

Re: [PATCH v3 0/2] Copy-on-write poison recovery

2022-10-23 Thread Shuai Xue
在 2022/10/22 AM4:01, Tony Luck 写道: > Part 1 deals with the process that triggered the copy on write > fault with a store to a shared read-only page. That process is > send a SIGBUS with the usual machine check decoration to specify > the virtual address of the lost page, together with the scope.

[PATCH v1 0/2] cleanup stackprotector canary generation

2022-10-23 Thread Jason A. Donenfeld
Stack canary generation currently lives partially in random.h, where it doesn't belong, and is in general a bit overcomplicated. This small patchset fixes up both issues. I'll take these in my tree, unless somebody else prefers to do so. Cc: Albert Ou Cc: Boris Ostrovsky Cc: Borislav Petkov Cc:

[PATCH v1 1/2] stackprotector: move CANARY_MASK and get_random_canary() into stackprotector.h

2022-10-23 Thread Jason A. Donenfeld
This has nothing to do with random.c and everything to do with stack protectors. Yes, it uses randomness. But many things use randomness. random.h and random.c are concerned with the generation of randomness, not with each and every use. So move this function into the more specific stackprotector.h

[PATCH v1 2/2] stackprotector: actually use get_random_canary()

2022-10-23 Thread Jason A. Donenfeld
The RNG always mixes in the Linux version extremely early in boot. It also always includes a cycle counter, not only during early boot, but each and every time it is invoked prior to being fully initialized. Together, this means that the use of additional xors inside of the various stackprotector.h

Re: [PATCH v1 0/5] convert tree to get_random_u32_{below,above,between}()

2022-10-23 Thread Theodore Ts'o
On Fri, Oct 21, 2022 at 11:03:22PM -0700, Jakub Kicinski wrote: > On Sat, 22 Oct 2022 07:47:06 +0200 Jason A. Donenfeld wrote: > > On Fri, Oct 21, 2022 at 10:32:42PM -0700, Jakub Kicinski wrote: > > > But whatever. I mean - hopefully there aren't any conflicts in the ~50 > > > networking files you

[PATCH] powerpc: replace ternary operator with min()

2022-10-23 Thread KaiLong Wang
Fix the following coccicheck warning: arch/powerpc/xmon/xmon.c:2987: WARNING opportunity for min() arch/powerpc/xmon/xmon.c:2583: WARNING opportunity for min() Signed-off-by: KaiLong Wang --- arch/powerpc/xmon/xmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/p

[PATCH v3 3/3] powerpc: mm: support page table check

2022-10-23 Thread Rohan McLure
On creation and clearing of a page table mapping, instrument such calls by invoking page_table_check_pte_set and page_table_check_pte_clear respectively. These calls serve as a sanity check against illegal mappings. Enable ARCH_SUPPORTS_PAGE_TABLE_CHECK for all ppc64, and 32-bit platforms implemen

[PATCH v3 2/3] powerpc: mm: add p{te,md,ud}_user_accessible_page helpers

2022-10-23 Thread Rohan McLure
Add the following helpers for detecting whether a page table entry is a leaf and is accessible to user space. * pte_user_accessible_page * pmd_user_accessible_page * pud_user_accessible_page Also implement missing pud_user definitions for both Book3S/nohash 64-bit systems, and pmd_user for Boo

[PATCH v3 1/3] powerpc: Add common pud_pfn stub for all platforms

2022-10-23 Thread Rohan McLure
Prior to this commit, pud_pfn was implemented with BUILD_BUG as the inline function for 64-bit Book3S systems but is never included, as its invocations in generic code are guarded by calls to pud_devmap which return zero on such systems. A future patch will provide support for page table checks, th

Re: [PATCH v1 2/2] stackprotector: actually use get_random_canary()

2022-10-23 Thread Guo Ren
On Mon, Oct 24, 2022 at 4:32 AM Jason A. Donenfeld wrote: > > The RNG always mixes in the Linux version extremely early in boot. It > also always includes a cycle counter, not only during early boot, but > each and every time it is invoked prior to being fully initialized. > Together, this means t

[PATCH] powerpc/64s/hash: add stress_hpt kernel boot option to increase hash faults

2022-10-23 Thread Nicholas Piggin
This option increases the number of hash misses by limiting the number of kernel HPT entries, by keeping a per-CPU record of the last kernel HPTEs installed, and removing that from the hash table on the next hash insertion. A timer round-robins CPUs removing remaining kernel HPTEs and clearing the

Re: [PATCH v8 1/6] powerpc: Allow clearing and restoring registers independent of saved breakpoint state

2022-10-23 Thread Russell Currey
On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > From: Jordan Niethe Hi Ben, > For the coming temporary mm used for instruction patching, the > breakpoint registers need to be cleared to prevent them from > accidentally being triggered. As soon as the patching is done, the > breakpoints

Re: [PATCH v8 2/6] powerpc/code-patching: Use WARN_ON and fix check in poking_init

2022-10-23 Thread Russell Currey
On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > From: "Christopher M. Riedl" > > The latest kernel docs list BUG_ON() as 'deprecated' and that they > should be replaced with WARN_ON() (or pr_warn()) when possible. The > BUG_ON() in poking_init() warrants a WARN_ON() rather than a > pr_w

Re: [PATCH v8 3/6] powerpc/code-patching: Verify instruction patch succeeded

2022-10-23 Thread Russell Currey
On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > Verifies that if the instruction patching did not return an error > then > the value stored at the given address to patch is now equal to the > instruction we patched it to. > > Signed-off-by: Benjamin Gray > --- >  arch/powerpc/lib/code-p

Re: [PATCH v8 4/6] powerpc/tlb: Add local flush for page given mm_struct and psize

2022-10-23 Thread Russell Currey
On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > Adds a local TLB flush operation that works given an mm_struct, VA to > flush, and page size representation. > > This removes the need to create a vm_area_struct, which the temporary > patching mm work does not need. > > Signed-off-by: Ben

Re: [PATCH v8 5/6] powerpc/code-patching: Use temporary mm for Radix MMU

2022-10-23 Thread Russell Currey
On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > From: "Christopher M. Riedl" > > x86 supports the notion of a temporary mm which restricts access to > temporary PTEs to a single CPU. A temporary mm is useful for > situations > where a CPU needs to perform sensitive operations (such as p

[PATCH] powerpc/8xx: Fix warning in hw_breakpoint_handler()

2022-10-23 Thread Russell Currey
In hw_breakpoint_handler(), ea is set by wp_get_instr_detail() except for 8xx, leading the variable to be passed uninitialised to wp_check_constraints(). This is safe as wp_check_constraints() returns early without using ea, so just set it to make the compiler happy. Signed-off-by: Russell Currey

Re: [PATCH v8 4/6] powerpc/tlb: Add local flush for page given mm_struct and psize

2022-10-23 Thread Russell Currey
On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > Adds a local TLB flush operation that works given an mm_struct, VA to > flush, and page size representation. > > This removes the need to create a vm_area_struct, which the temporary > patching mm work does not need. > > Signed-off-by: Ben

Re: [PATCH] powerpc: replace ternary operator with min()

2022-10-23 Thread Russell Currey
On Sun, 2022-10-23 at 20:44 +0800, KaiLong Wang wrote: > Fix the following coccicheck warning: > > arch/powerpc/xmon/xmon.c:2987: WARNING opportunity for min() > arch/powerpc/xmon/xmon.c:2583: WARNING opportunity for min() > > Signed-off-by: KaiLong Wang Hello, This fails to compile on some pl

Re: [PATCH v1 0/2] cleanup stackprotector canary generation

2022-10-23 Thread Greg Kroah-Hartman
On Sun, Oct 23, 2022 at 10:32:06PM +0200, Jason A. Donenfeld wrote: > Stack canary generation currently lives partially in random.h, where it > doesn't belong, and is in general a bit overcomplicated. This small > patchset fixes up both issues. I'll take these in my tree, unless > somebody else pre

Re: [PATCH v8 5/6] powerpc/code-patching: Use temporary mm for Radix MMU

2022-10-23 Thread Benjamin Gray
On Mon, 2022-10-24 at 14:45 +1100, Russell Currey wrote: > On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > > From: "Christopher M. Riedl" > > > > x86 supports the notion of a temporary mm which restricts access to > > temporary PTEs to a single CPU. A temporary mm is useful for > > situ

Re: [PATCH v8 4/6] powerpc/tlb: Add local flush for page given mm_struct and psize

2022-10-23 Thread Benjamin Gray
On Mon, 2022-10-24 at 14:30 +1100, Russell Currey wrote: > On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote: > > Adds a local TLB flush operation that works given an mm_struct, VA > > to > > flush, and page size representation. > > > > This removes the need to create a vm_area_struct, which