Re: [PATCH v1 1/4] kasan: Avoid sleepable page allocation from atomic context

2025-04-10 Thread Nicholas Piggin
On Tue Apr 8, 2025 at 1:11 AM AEST, Alexander Gordeev wrote: > apply_to_page_range() enters lazy MMU mode and then invokes > kasan_populate_vmalloc_pte() callback on each page table walk > iteration. The lazy MMU mode may only be entered only under > protection of the page table lock. However, the

Re: [PATCH v1 3/4] mm: Protect kernel pgtables in apply_to_pte_range()

2025-04-10 Thread Nicholas Piggin
On Tue Apr 8, 2025 at 1:11 AM AEST, Alexander Gordeev wrote: > The lazy MMU mode can only be entered and left under the protection > of the page table locks for all page tables which may be modified. > Yet, when it comes to kernel mappings apply_to_pte_range() does not > take any locks. That does n

Re: [PATCH v1 2/4] mm: Cleanup apply_to_pte_range() routine

2025-04-10 Thread Nicholas Piggin
On Tue Apr 8, 2025 at 1:11 AM AEST, Alexander Gordeev wrote: > Reverse 'create' vs 'mm == &init_mm' conditions and move > page table mask modification out of the atomic context. > > Signed-off-by: Alexander Gordeev > --- > mm/memory.c | 28 +--- > 1 file changed, 17 insert

Re: [PATCH v1 1/4] kasan: Avoid sleepable page allocation from atomic context

2025-04-10 Thread Nicholas Piggin
On Tue Apr 8, 2025 at 1:11 AM AEST, Alexander Gordeev wrote: > apply_to_page_range() enters lazy MMU mode and then invokes > kasan_populate_vmalloc_pte() callback on each page table walk > iteration. The lazy MMU mode may only be entered only under > protection of the page table lock. However, the

Re: [PATCH net-next] ibmveth: Use WARN_ON with error handling rather than BUG_ON

2025-04-10 Thread Michal Swiatkowski
On Thu, Apr 10, 2025 at 01:39:18PM -0500, Dave Marquardt wrote: > - Replaced BUG_ON calls with WARN_ON calls with error handling, > with calls to a new ibmveth_reset routine, which resets the device. > - Added KUnit tests for ibmveth_remove_buffer_from_pool and > ibmveth_rxq_get_buffer under ne

Re: [PATCH v13 04/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_clear()

2025-04-10 Thread Andrew Donnellan
On Thu, 2025-03-13 at 16:10 -0700, Andrew Morton wrote: > On Wed, 12 Feb 2025 03:13:57 +1100 Andrew Donnellan > wrote: > > > This reverts commit 931c38e16499 ("mm/page_table_check: remove > > unused > > parameter in [__]page_table_check_pud_clear"). > > > > Reinstate previously unused parameters

[PATCH v14 06/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pte_clear()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure This reverts commit aa232204c468 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pte_clear"). Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but

[PATCH v14 07/11] mm: Provide address parameter to p{te,md,ud}_user_accessible_page()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure On several powerpc platforms, a page table entry may not imply whether the relevant mapping is for userspace or kernelspace. Instead, such platforms infer this by the address which is being accessed. Add an additional address argument to each of these routines in order to prov

[PATCH v14 08/11] powerpc: mm: Add pud_pfn() stub

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure The page table check feature requires that pud_pfn() be defined on each consuming architecture. Since only 64-bit, Book3S platforms allow for hugepages at this upper level, and since the calling code is gated by a call to pud_user_accessible_page(), which will return zero, incl

[PATCH v14 02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure This reverts commit a3b837130b58 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_set"). Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but in

[PATCH v14 09/11] powerpc: mm: Implement *_user_accessible_page() for ptes

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure Page table checking depends on architectures providing an implementation of p{te,md,ud}_user_accessible_page. With refactorisations made on powerpc/mm, the pte_access_permitted() and similar methods verify whether a userland page is accessible with the required permissions. Si

[PATCH v14 04/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_clear()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure This reverts commit 931c38e16499 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pud_clear"). Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but

[PATCH v14 03/11] mm/page_table_check: Provide addr parameter to page_table_check_pte_set()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure To provide support for powerpc platforms, provide an addr parameter to the page_table_check_pte_set() routine. This parameter is needed on some powerpc platforms which do not encode whether a mapping is for user or kernel in the pte. On such platforms, this can be inferred form

[PATCH v14 10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure In the new set_ptes() API, set_pte_at() (a special case of set_ptes()) is intended to be instrumented by the page table check facility. There are however several other routines that constitute the API for setting page table entries, including set_pmd_at() among others. Such rou

[PATCH v14 11/11] powerpc: mm: Support page table check

2025-04-10 Thread Andrew Donnellan
From: 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 platforms. See

[PATCH v14 00/11] Support page table check on PowerPC

2025-04-10 Thread Andrew Donnellan
Support page table check on all PowerPC platforms. This works by serialising assignments, reassignments and clears of page table entries at each level in order to ensure that anonymous mappings have at most one writable consumer, and likewise that file-backed mappings are not simultaneously also an

[PATCH v14 01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure This reverts commit 6d144436d954 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pud_set"). Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but in

[PATCH v14 05/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_clear()

2025-04-10 Thread Andrew Donnellan
From: Rohan McLure This reverts commit 1831414cd729 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_clear"). Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but

[PATCH 5.10.y] powerpc/rtas: Prevent Spectre v1 gadget construction in sys_rtas()

2025-04-10 Thread Cliff Liu
From: Nathan Lynch [ Upstream commit 0974d03eb479384466d828d65637814bee6b26d7 ] Smatch warns: arch/powerpc/kernel/rtas.c:1932 __do_sys_rtas() warn: potential spectre issue 'args.args' [r] (local cap) The 'nargs' and 'nret' locals come directly from a user-supplied buffer and are used as in

kexec is not working in 6.15-rc1

2025-04-10 Thread Sourabh Jain
Hello All, I noticed that kexec is broken on the upstream v6.15-rc1 kernel. My testing was limited to PowerPC (pSeries), but it's possible that other architectures may have a similar issue. Both the first and kexec kernel are v6.15-rc1. Distro: RHEL Kexec command to load kexec kernel: -

Re: [RFC PATCH] powerpc: Add check to select PPC_RADIX_BROADCAST_TLBIE

2025-04-10 Thread Christophe Leroy
Le 07/04/2025 à 21:10, Ritesh Harjani (IBM) a écrit : Madhavan Srinivasan writes: Commit 3d45a3d0d2e6 ("powerpc: Define config option for processors with broadcast TLBIE") We may need to add above to Fixes tag as well, no? added a config option PPC_RADIX_BROADCAST_TLBIE to support proc

[PATCH v2 09/12] arm64: mm: Always call PTE/PMD ctor in __create_pgd_mapping()

2025-04-10 Thread Kevin Brodsky
TL;DR: always call the PTE/PMD ctor, passing the appropriate mm to skip ptlock_init() if unneeded. __create_pgd_mapping() is used for creating different kinds of mappings, and may allocate page table pages if passed an allocator callback. There are currently three such cases: 1. create_pgd_mappin

[PATCH v2 04/12] m68k: mm: Call ctor/dtor for kernel PTEs

2025-04-10 Thread Kevin Brodsky
The generic implementation of pte_{alloc_one,free}_kernel now calls the [cd]tor. Align the m68k/ColdFire implementation of those functions by calling the [cd]tor explicitly. Signed-off-by: Kevin Brodsky --- arch/m68k/include/asm/mcf_pgalloc.h | 6 +- 1 file changed, 5 insertions(+), 1 deleti

Re: [PATCH v2 3/3] mm: Protect kernel pgtables in apply_to_pte_range()

2025-04-10 Thread Andrew Morton
On Thu, 10 Apr 2025 16:50:33 +0200 Alexander Gordeev wrote: > On Tue, Apr 08, 2025 at 06:07:32PM +0200, Alexander Gordeev wrote: > > Hi Andrew, > > > The lazy MMU mode can only be entered and left under the protection > > of the page table locks for all page tables which may be modified. > >

[PATCH 2/6] bus: fsl-mc: do not add a device-link for the UAPI used DPMCP device

2025-04-10 Thread Ioana Ciornei
The fsl-mc bus associated to the root DPRC in a DPAA2 system exports a device file for userspace access to the MC firmware. In case the DPRC's local MC portal (DPMCP) is currently in use, a new DPMCP device is allocated through the fsl_mc_portal_allocate() function. In this case, the call to fsl_m

Re: [PATCH] dt-bindings: soc: fsl: fsl,ls1028a-reset: Fix maintainer entry

2025-04-10 Thread Frank Li
On Thu, Apr 10, 2025 at 06:11:12PM +0200, Geert Uytterhoeven wrote: > make dt_binding_check: > > Documentation/devicetree/bindings/soc/fsl/fsl,ls1028a-reset.yaml: > maintainers:0: 'Frank Li' does not match '@' > from schema $id: http://devicetree.org/meta-schemas/base.yaml# > > Fix t

Re: [PATCH v2 02/12] x86: pgtable: Always use pte_free_kernel()

2025-04-10 Thread Matthew Wilcox
On Tue, Apr 08, 2025 at 08:22:47AM -0700, Dave Hansen wrote: > Are there any tests for folio_test_pgtable() at free_page() time? If we > had that, it would make it less likely that another free_page() user > could sneak in without calling the destructor. It's hidden, but yes: static inline bool p

[PATCH net-next] ibmveth: Use WARN_ON with error handling rather than BUG_ON

2025-04-10 Thread Dave Marquardt
- Replaced BUG_ON calls with WARN_ON calls with error handling, with calls to a new ibmveth_reset routine, which resets the device. - Added KUnit tests for ibmveth_remove_buffer_from_pool and ibmveth_rxq_get_buffer under new IBMVETH_KUNIT_TEST config option. - Removed unneeded forward declarati

Re: [RFC PATCH] powerpc: Add check to select PPC_RADIX_BROADCAST_TLBIE

2025-04-10 Thread Ritesh Harjani (IBM)
Madhavan Srinivasan writes: > Commit 3d45a3d0d2e6 ("powerpc: Define config option for processors with > broadcast TLBIE") We may need to add above to Fixes tag as well, no? > added a config option PPC_RADIX_BROADCAST_TLBIE to support processors with > broadcast TLBIE. Since this option is rele

[PATCH 4/5] powerpc: 52xx/gpio: use new line value setter callbacks

2025-04-10 Thread Bartosz Golaszewski
From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 6 -- 1 file changed, 4 insertion

[PATCH 3/5] powerpc: 44x/gpio: use new line value setter callbacks

2025-04-10 Thread Bartosz Golaszewski
From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- arch/powerpc/platforms/44x/gpio.c | 7 --- 1 file changed, 4 insertions(+), 3

[PATCH v2 3/4] tpm/tpm_ftpm_tee: support TPM_CHIP_FLAG_SYNC

2025-04-10 Thread Stefano Garzarella
From: Stefano Garzarella This driver does not support interrupts, and receiving the response is synchronous with sending the command. So we can set TPM_CHIP_FLAG_SYNC to support synchronous send() and return responses in the same buffer used for commands. This way we don't need the 4KB internal

[PATCH] crypto: scomp - Fix null-pointer deref when freeing streams

2025-04-10 Thread Herbert Xu
On Mon, Apr 07, 2025 at 11:49:27PM +0530, Sourabh Jain wrote: > > [   90.892796] NIP [c0845eb0] scomp_free_streams+0x6c/0xe8 > [   90.892803] LR [c0845ee0] scomp_free_streams+0x9c/0xe8 Looks like I never tested 842 which curiously does not have a self-test. Please try this patch:

[PATCH 1/5] powerpc: sysdev/gpio: use new line value setter callbacks

2025-04-10 Thread Bartosz Golaszewski
From: Bartosz Golaszewski struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Signed-off-by: Bartosz Golaszewski --- arch/powerpc/sysdev/cpm_common.c | 6 -- 1 file changed, 4 insertions(+), 2 d

[PATCH] dt-bindings: soc: fsl: fsl,ls1028a-reset: Fix maintainer entry

2025-04-10 Thread Geert Uytterhoeven
make dt_binding_check: Documentation/devicetree/bindings/soc/fsl/fsl,ls1028a-reset.yaml: maintainers:0: 'Frank Li' does not match '@' from schema $id: http://devicetree.org/meta-schemas/base.yaml# Fix this by adding Frank's email address. Fixes: 9ca5a7d9d2e05de6 ("dt-bindings: s

Re: [PATCH v2 1/3] kasan: Avoid sleepable page allocation from atomic context

2025-04-10 Thread Alexander Gordeev
On Wed, Apr 09, 2025 at 04:56:29PM +0200, Andrey Ryabinin wrote: Hi Andrey, ... > >>> - page = __get_free_page(GFP_KERNEL); > >>> + page = __get_free_page(GFP_ATOMIC); > >>> if (!page) > >> I think a better way to fix this would be moving out allocation from > >> atomic context. Allocate page

Re: [PATCH v2 3/3] mm: Protect kernel pgtables in apply_to_pte_range()

2025-04-10 Thread Alexander Gordeev
On Tue, Apr 08, 2025 at 06:07:32PM +0200, Alexander Gordeev wrote: Hi Andrew, > The lazy MMU mode can only be entered and left under the protection > of the page table locks for all page tables which may be modified. Heiko Carstens noticed that the above claim is not valid, since v6.15-rc1 commi

Re: [PATCH] ASoC: fsl: fsl_qmc_audio: Reset audio data pointers on TRIGGER_START event

2025-04-10 Thread Mark Brown
On Thu, 10 Apr 2025 11:16:43 +0200, Herve Codina wrote: > On SNDRV_PCM_TRIGGER_START event, audio data pointers are not reset. > > This leads to wrong data buffer usage when multiple TRIGGER_START are > received and ends to incorrect buffer usage between the user-space and > the driver. Indeed, th

Re: [PATCH] ASoC: fsl: fsl_qmc_audio: Reset audio data pointers on TRIGGER_START event

2025-04-10 Thread Christophe Leroy
Le 10/04/2025 à 11:16, Herve Codina a écrit : On SNDRV_PCM_TRIGGER_START event, audio data pointers are not reset. This leads to wrong data buffer usage when multiple TRIGGER_START are received and ends to incorrect buffer usage between the user-space and the driver. Indeed, the driver can re

[PATCH] ASoC: fsl: fsl_qmc_audio: Reset audio data pointers on TRIGGER_START event

2025-04-10 Thread Herve Codina
On SNDRV_PCM_TRIGGER_START event, audio data pointers are not reset. This leads to wrong data buffer usage when multiple TRIGGER_START are received and ends to incorrect buffer usage between the user-space and the driver. Indeed, the driver can read data that are not already set by the user-space