Skip to contentSkip to conversation

5.10.121-rc1 review

PATCH In review Greg Kroah-Hartman 12 participants 474 messages Jun 7, 2022 – Jun 16, 2022 Page 4 of 4

Subsystems (3)
lore
Share & tools
lore
author maintainer
#377 lore raw

PATCH 362/452 ext4: filter out EXT4_FC_REPLAY from on-disk superblock field s_state

In reply to Greg Kroah-Hartman

From: Theodore Ts'o <[email protected]>

commit c878bea3c9d724ddfa05a813f30de3d25a0ba83f upstream.

The EXT4_FC_REPLAY bit in sbi->s_mount_state is used to indicate that we are in the middle of replay the fast commit journal. This was actually a mistake, since the sbi->s_mount_info is initialized from es->s_state. Arguably s_mount_state is misleadingly named, but the name is historical --- s_mount_state and s_state dates back to ext2.

What should have been used is the ext4_{set,clear,test}_mount_flag() inline functions, which sets EXT4_MF_* bits in sbi->s_mount_flags.

The problem with using EXT4_FC_REPLAY is that a maliciously corrupted superblock could result in EXT4_FC_REPLAY getting set in s_mount_state. This bypasses some sanity checks, and this can trigger a BUG() in ext4_es_cache_extent(). As a easy-to-backport-fix, filter out the EXT4_FC_REPLAY bit for now. We should eventually transition away from EXT4_FC_REPLAY to something like EXT4_MF_REPLAY.

---
 fs/ext4/super.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/super.c +3 -2
@@ -4538,7 +4538,7 @@ static int ext4_fill_super(struct super_
 					sbi->s_inodes_per_block;
 	sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
 	sbi->s_sbh = bh;
-	sbi->s_mount_state = le16_to_cpu(es->s_state);
+	sbi->s_mount_state = le16_to_cpu(es->s_state) & ~EXT4_FC_REPLAY;
 	sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));
 	sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));
 
@@ -5998,7 +5998,8 @@ static int ext4_remount(struct super_blo
 				if (err)
 					goto restore_opts;
 			}
-			sbi->s_mount_state = le16_to_cpu(es->s_state);
+			sbi->s_mount_state = (le16_to_cpu(es->s_state) &
+					      ~EXT4_FC_REPLAY);
 
 			err = ext4_setup_super(sb, es, 0);
 			if (err)
author maintainer
#381 lore raw

PATCH 366/452 ACPI: property: Release subnode properties with data nodes

In reply to Greg Kroah-Hartman

From: Sakari Ailus <[email protected]>

commit 3bd561e1572ee02a50cd1a5be339abf1a5b78d56 upstream.

struct acpi_device_properties describes one source of properties present on either struct acpi_device or struct acpi_data_node. When properties are parsed, both are populated but when released, only those properties that are associated with the device node are freed.

Fix this by also releasing memory of the data node properties.

Fixes 5f5e4890d57a ("ACPI / property: Allow multiple property compatible _DSD entries")
Cc 4.20+ <[email protected]> # 4.20+
---
 drivers/acpi/property.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/acpi/property.c +12 -6
@@ -433,6 +433,16 @@ void acpi_init_properties(struct acpi_de
 		acpi_extract_apple_properties(adev);
 }
 
+static void acpi_free_device_properties(struct list_head *list)
+{
+	struct acpi_device_properties *props, *tmp;
+
+	list_for_each_entry_safe(props, tmp, list, list) {
+		list_del(&props->list);
+		kfree(props);
+	}
+}
+
 static void acpi_destroy_nondev_subnodes(struct list_head *list)
 {
 	struct acpi_data_node *dn, *next;
@@ -445,22 +455,18 @@ static void acpi_destroy_nondev_subnodes
 		wait_for_completion(&dn->kobj_done);
 		list_del(&dn->sibling);
 		ACPI_FREE((void *)dn->data.pointer);
+		acpi_free_device_properties(&dn->data.properties);
 		kfree(dn);
 	}
 }
 
 void acpi_free_properties(struct acpi_device *adev)
 {
-	struct acpi_device_properties *props, *tmp;
-
 	acpi_destroy_nondev_subnodes(&adev->data.subnodes);
 	ACPI_FREE((void *)adev->data.pointer);
 	adev->data.of_compatible = NULL;
 	adev->data.pointer = NULL;
-	list_for_each_entry_safe(props, tmp, &adev->data.properties, list) {
-		list_del(&props->list);
-		kfree(props);
-	}
+	acpi_free_device_properties(&adev->data.properties);
 }
 
 /**
author maintainer
#380 lore raw

PATCH 365/452 ext4: avoid cycles in directory h-tree

In reply to Greg Kroah-Hartman

From: Jan Kara <[email protected]>

commit 3ba733f879c2a88910744647e41edeefbc0d92b2 upstream.

A maliciously corrupted filesystem can contain cycles in the h-tree stored inside a directory. That can easily lead to the kernel corrupting tree nodes that were already verified under its hands while doing a node split and consequently accessing unallocated memory. Fix the problem by verifying traversed block numbers are unique.

---
 fs/ext4/namei.c |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
fs/ext4/namei.c +19 -3
@@ -756,12 +756,14 @@ static struct dx_frame *
 dx_probe(struct ext4_filename *fname, struct inode *dir,
 	 struct dx_hash_info *hinfo, struct dx_frame *frame_in)
 {
-	unsigned count, indirect;
+	unsigned count, indirect, level, i;
 	struct dx_entry *at, *entries, *p, *q, *m;
 	struct dx_root *root;
 	struct dx_frame *frame = frame_in;
 	struct dx_frame *ret_err = ERR_PTR(ERR_BAD_DX_DIR);
 	u32 hash;
+	ext4_lblk_t block;
+	ext4_lblk_t blocks[EXT4_HTREE_LEVEL];
 
 	memset(frame_in, 0, EXT4_HTREE_LEVEL * sizeof(frame_in[0]));
 	frame->bh = ext4_read_dirblock(dir, 0, INDEX);
@@ -817,6 +819,8 @@ dx_probe(struct ext4_filename *fname, st
 	}
 
 	dxtrace(printk("Look up %x", hash));
+	level = 0;
+	blocks[0] = 0;
 	while (1) {
 		count = dx_get_count(entries);
 		if (!count || count > dx_get_limit(entries)) {
@@ -858,15 +862,27 @@ dx_probe(struct ext4_filename *fname, st
 			       dx_get_block(at)));
 		frame->entries = entries;
 		frame->at = at;
-		if (!indirect--)
+
+		block = dx_get_block(at);
+		for (i = 0; i <= level; i++) {
+			if (blocks[i] == block) {
+				ext4_warning_inode(dir,
+					"dx entry: tree cycle block %u points back to block %u",
+					blocks[level], block);
+				goto fail;
+			}
+		}
+		if (++level > indirect)
 			return frame;
+		blocks[level] = block;
 		frame++;
-		frame->bh = ext4_read_dirblock(dir, dx_get_block(at), INDEX);
+		frame->bh = ext4_read_dirblock(dir, block, INDEX);
 		if (IS_ERR(frame->bh)) {
 			ret_err = (struct dx_frame *) frame->bh;
 			frame->bh = NULL;
 			goto fail;
 		}
+
 		entries = ((struct dx_node *) frame->bh->b_data)->entries;
 
 		if (dx_get_limit(entries) != dx_node_limit(dir)) {
#73 lore raw

RE: [PATCH 5.10 065/452] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo

In reply to Deucher, Alexander

[Public]

Quoted 34 lines

-----Original Message-----
From: Deucher, Alexander
Sent: Tuesday, June 7, 2022 1:33 PM
To: Greg Kroah-Hartman <[email protected]>; linux- [email protected]
Cc: [email protected]; Wong, Alice <[email protected]>; Sasha Levin <[email protected]>
Subject: RE: [PATCH 5.10 065/452] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo

[Public]

Quoted 7 lines

-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Tuesday, June 7, 2022 12:59 PM
To: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; [email protected]; Wong, Alice <[email protected]>; Deucher, Alexander <[email protected]>; Sasha Levin

<[email protected]>

Quoted 14 lines

Subject: [PATCH 5.10 065/452] drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo

From: Alice Wong <[email protected]>

[ Upstream commit ab0cd4a9ae5b4679b714d8dbfedc0901fecdce9f ]

When psp_hw_init failed, it will set the load_type to AMDGPU_FW_LOAD_DIRECT.
During amdgpu_device_ip_fini, amdgpu_ucode_free_bo checks that load_type is AMDGPU_FW_LOAD_DIRECT and skips deallocating fw_buf causing memory leak.
Remove load_type check in amdgpu_ucode_free_bo.

Quoted 8 lines
Quoted 4 lines

I don't think this patch is relevant for kernels older than 5.19. I shouldn't hurt anything however.

Nevermind, I see that Sasha backported the entire series that this patch depends on.

Alex

Quoted 27 lines

Alex

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c int amdgpu_ucode_create_bo(struct

Quoted 10 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +0 -0
index b313ce4c3e97..30005ed8156f 100644
@@ -625,8 +625,7 @@ int amdgpu_ucode_create_bo(struct

amdgpu_device

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -3
 *adev)
 
 void amdgpu_ucode_free_bo(struct amdgpu_device *adev)  {
-	if (adev->firmware.load_type != AMDGPU_FW_LOAD_DIRECT)
-		amdgpu_bo_free_kernel(&adev->firmware.fw_buf,
+	amdgpu_bo_free_kernel(&adev->firmware.fw_buf,
 		&adev->firmware.fw_buf_mc,
 		&adev->firmware.fw_buf_ptr);
 }
--

2.35.1

author maintainer
#464 lore raw

PATCH 449/452 MIPS: IP27: Remove incorrect `cpu_has_fpu override

In reply to Greg Kroah-Hartman

From: Maciej W. Rozycki <[email protected]>

commit 424c3781dd1cb401857585331eaaa425a13f2429 upstream.

Remove unsupported forcing of cpu_has_fpu' to 1, which makes the nofpu' kernel parameter non-functional, and also causes a link error:

ld: arch/mips/kernel/traps.o: in function `trap_init':
./arch/mips/include/asm/msa.h:(.init.text+0x348): undefined reference to `handle_fpe'
ld: ./arch/mips/include/asm/msa.h:(.init.text+0x354): undefined reference to `handle_fpe'
ld: ./arch/mips/include/asm/msa.h:(.init.text+0x360): undefined reference to `handle_fpe'

where the CONFIG_MIPS_FP_SUPPORT configuration option has been disabled.

Fixes 0ebb2f4159af ("MIPS: IP27: Update/restructure CPU overrides")
---
 arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h |    1 -
 1 file changed, 1 deletion(-)
arch/mips/include/asm/mach-ip27/cpu-feature-overrides.h +0 -1
@@ -26,7 +26,6 @@
 #define cpu_has_3k_cache		0
 #define cpu_has_4k_cache		1
 #define cpu_has_tx39_cache		0
-#define cpu_has_fpu			1
 #define cpu_has_nofpuex			0
 #define cpu_has_32fpr			1
 #define cpu_has_counter			1
Tested-by on the v1 series
#468 lore raw
In reply to Greg Kroah-Hartman

Hi!

Quoted 4 lines

This is the start of the stable review cycle for the 5.10.121 release. There are 452 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

CIP testing did not find any problems here:

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y

Best regards,
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Tested-by on the v1 series
#469 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.121 release. There are 452 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.121-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

#3 lore raw

Re: [PATCH 5.10 001/452] arm64: Initialize jump labels before setup_machine_fdt()

In reply to Catalin Marinas
Quoted 65 lines · Catalin Marinas

Hi Greg,

Quoted 47 lines · Greg Kroah-Hartman

From: Stephen Boyd <[email protected]>

commit 73e2d827a501d48dceeb5b9b267a4cd283d6b1ae upstream.

A static key warning splat appears during early boot on arm64 systems that credit randomness from devicetrees that contain an "rng-seed" property. This is because setup_machine_fdt() is called before jump_label_init() during setup_arch(). Let's swap the order of these two calls so that jump labels are initialized before the devicetree is unflattened and the rng seed is credited.

static_key_enable_cpuslocked(): static key '0xffffffe51c6fcfc0' used before call to jump_label_init()

 WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xb0/0xb8
 Modules linked in:
 CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0+ #224 44b43e377bfc84bc99bb5ab885ff694984ee09ff
 pstate: 600001c9 (nZCv dAIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : static_key_enable_cpuslocked+0xb0/0xb8
 lr : static_key_enable_cpuslocked+0xb0/0xb8
 sp : ffffffe51c393cf0
 x29: ffffffe51c393cf0 x28: 000000008185054c x27: 00000000f1042f10
 x26: 0000000000000000 x25: 00000000f10302b2 x24: 0000002513200000
 x23: 0000002513200000 x22: ffffffe51c1c9000 x21: fffffffdfdc00000
 x20: ffffffe51c2f0831 x19: ffffffe51c6fcfc0 x18: 00000000ffff1020
 x17: 00000000e1e2ac90 x16: 00000000000000e0 x15: ffffffe51b710708
 x14: 0000000000000066 x13: 0000000000000018 x12: 0000000000000000
 x11: 0000000000000000 x10: 00000000ffffffff x9 : 0000000000000000
 x8 : 0000000000000000 x7 : 61632065726f6665 x6 : 6220646573752027
 x5 : ffffffe51c641d25 x4 : ffffffe51c13142c x3 : ffff0a00ffffff05
 x2 : 40000000ffffe003 x1 : 00000000000001c0 x0 : 0000000000000065
 Call trace:
  static_key_enable_cpuslocked+0xb0/0xb8
  static_key_enable+0x2c/0x40
  crng_set_ready+0x24/0x30
  execute_in_process_context+0x80/0x90
  _credit_init_bits+0x100/0x154
  add_bootloader_randomness+0x64/0x78
  early_init_dt_scan_chosen+0x140/0x184
  early_init_dt_scan_nodes+0x28/0x4c
  early_init_dt_scan+0x40/0x44
  setup_machine_fdt+0x7c/0x120
  setup_arch+0x74/0x1d8
  start_kernel+0x84/0x44c
  __primary_switched+0xc0/0xc8
 ---[ end trace 0000000000000000 ]---
 random: crng init done
 Machine model: Google Lazor (rev1 - 2) with LTE
Quoted 13 lines
Cc Hsin-Yi Wang <[email protected]>
Cc Douglas Anderson <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Jason A. Donenfeld <[email protected]>
Cc Dominik Brodowski <[email protected]>
Fixes f5bda35fba61 ("random: use static branch for crng_ready()")
Quoted 6 lines

Since Jason asked for the fixed commit (f5bda35fba61) to be reverted in stable, please don't push this arm64 patch either. Given the risks of breakage as on arm32 (it doesn't look like but you never know), I'm tempted to revert it from mainline as well if Jason finds a better solution for the early crng_reseed() call.

So as I understand it, there are basically three options:
0. don't use a static branch in the RNG code
1. use a static branch but don't patch it extremely early
2. fix all the arch code so that it is safe to patch static branches extremely early.

We have been digging into the ARM code yesterday, and identified that RISC-V needs to be fixed as well. In fact, every arch that calls early_init_dt_scan() from setup_arch() will need to be vetted to ensure that jump label patching is possible this early.

Jason already proposed an implementation of 1) here

https://lore.kernel.org/lkml/[email protected]/

which seems to me to be the most suitable approach by far, given that it removes the need to fiddle with very early boot code on many different architectures. That would also allow the arm64 of /this/ patch to be reverted from mainline.

#4 lore raw

Re: [PATCH 5.10 001/452] arm64: Initialize jump labels before setup_machine_fdt()

Hi Ard,

This thread here is about stable review. Catalin mentioned to Greg that the arm64 patch isn't required any more. I also mentioned the same to Greg yesterday when it was in queue. Either way, what happens in 5.19 no longer has any effect on stable any more, since it's been reverted in stable. Therefore, I kindly ask you not to start yet *another* thread about the same topic we've been discussing over the last day. There are already 7 discussions about exactly the same thing; no need to make another. Let's resume working on this all today.

Jason

Tested-by on the v1 series
#470 lore raw
In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 7 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.121 release. There are 452 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.

Build test (gcc version 11.3.1 20220606):
mips: 63 configs -> no failure
arm: 104 configs -> no failure
arm64: 3 configs -> no failure
x86_64: 4 configs -> no failure
alpha allmodconfig -> no failure
riscv allmodconfig -> no failure
s390 allmodconfig -> no failure
xtensa allmodconfig -> no failure

Boot test:
x86_64: Booted on my test laptop. No regression.
x86_64: Booted on qemu. No regression. [1]
arm64: Booted on rpi4b (4GB model). No regression. [2]

[1]. https://openqa.qa.codethink.co.uk/tests/1288
[2]. https://openqa.qa.codethink.co.uk/tests/1292

--
Regards
Sudip

#15 lore raw

Re: [PATCH 5.10 011/452] usb: dwc3: gadget: Move null pinter check to proper place

In reply to Greg Kroah-Hartman

Hi!

Quoted 8 lines

commit 3c5880745b4439ac64eccdb040e37fc1cc4c5406 upstream.

When dwc3_gadget_ep_cleanup_completed_requests() called to dwc3_gadget_giveback() where the dwc3 lock is released, other thread is able to execute. In this situation, usb_ep_disable() gets the chance to clear endpoint descriptor pointer which leds to the null pointer dereference problem. So needs to move the null pointer check to a proper place.

Ok, but could someone check the error handling there? There's some cleanup at the out label, but moved code does not jump there.

Best regards,
Pavel

Quoted 20 lines

+++ b/drivers/usb/dwc3/gadget.c

drivers/usb/dwc3/gadget.c +3 -3
@@ -2960,14 +2960,14 @@ static bool dwc3_gadget_endpoint_trbs_co
 	struct dwc3		*dwc = dep->dwc;
 	bool			no_started_trb = true;
 
-	if (!dep->endpoint.desc)
-		return no_started_trb;
-
 	dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
 
 	if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
 		goto out;
 
+	if (!dep->endpoint.desc)
+		return no_started_trb;
+
 	if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
 		list_empty(&dep->started_list) &&
 		(list_empty(&dep->pending_list) || status == -EXDEV))
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#31 lore raw

Re: [PATCH 5.10 026/452] selftests/bpf: Fix vfs_link kprobe definition

In reply to Greg Kroah-Hartman

Hi!

Quoted 8 lines

[ Upstream commit e299bcd4d16ff86f46c48df1062c8aae0eca1ed8 ]

Since commit 6521f8917082 ("namei: prepare for idmapped mounts") vfs_link's prototype was changed, the kprobe definition in profiler selftest in turn wasn't updated. The result is that all argument after the first are now stored in different registers. This means that self-test has been broken ever since. Fix it by updating the kprobe definition accordingly.

I don't see 6521f8917082 ("namei: prepare for idmapped mounts") in 5.10-stable tree. In 5.10, we still have:

include/linux/fs.h:extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);

I believe that means we should not have this one, either.

Best regards,
Pavel

Quoted 17 lines

+++ b/tools/testing/selftests/bpf/progs/profiler.inc.h

tools/testing/selftests/bpf/progs/profiler.inc.h +3 -2
@@ -826,8 +826,9 @@ int kprobe_ret__do_filp_open(struct pt_regs* ctx)
 
 SEC("kprobe/vfs_link")
 int BPF_KPROBE(kprobe__vfs_link,
-	       struct dentry* old_dentry, struct inode* dir,
-	       struct dentry* new_dentry, struct inode** delegated_inode)
+	       struct dentry* old_dentry, struct user_namespace *mnt_userns,
+	       struct inode* dir, struct dentry* new_dentry,
+	       struct inode** delegated_inode)
 {
 	struct bpf_func_stats_ctx stats_ctx;
 	bpf_stats_enter(&stats_ctx, profiler_bpf_vfs_link);
Signature · 1 line
2.35.1
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#145 lore raw

Re: [PATCH 5.10 136/452] bpf: Fix excessive memory allocation in stack_map_alloc()

In reply to Greg Kroah-Hartman

Hi!

Quoted 6 lines

The 'n_buckets * (value_size + sizeof(struct stack_map_bucket))' part of the allocated memory for 'smap' is never used after the memlock accounting was removed, thus get rid of it.

[ Note, Daniel:

Quoted 8 lines

Commit b936ca643ade ("bpf: rework memlock-based memory accounting for maps") moved cost += n_buckets * (value_size + sizeof(struct stack_map_bucket)) up and therefore before the bpf_map_area_alloc() allocation, sigh. In a later step commit c85d69135a91 ("bpf: move memory size checks to bpf_map_charge_init()"), and the overflow checks of cost >= U32_MAX - PAGE_SIZE moved into bpf_map_charge_init(). And then 370868107bf6 ("bpf: Eliminate rlimit-based memory accounting for stackmap maps") finally removed the bpf_map_charge_init(). Anyway, the original code did the allocation same way as /after/ this fix. ]

We don't have 370868107bf6 in 5.10. Can someone verify this is still right think to do for 5.10?

Best regards,
Pavel

Quoted 9 lines

+++ b/kernel/bpf/stackmap.c

kernel/bpf/stackmap.c +0 -1
@@ -121,7 +121,6 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 		return ERR_PTR(-E2BIG);
 
 	cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
-	cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));
 	err = bpf_map_charge_init(&mem, cost);
 	if (err)
 		return ERR_PTR(err);
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
author maintainer
#32 lore raw

Re: [PATCH 5.10 026/452] selftests/bpf: Fix vfs_link kprobe definition

In reply to Pavel Machek
Quoted 11 lines · Pavel Machek

Hi!

Quoted 8 lines

[ Upstream commit e299bcd4d16ff86f46c48df1062c8aae0eca1ed8 ]

Since commit 6521f8917082 ("namei: prepare for idmapped mounts") vfs_link's prototype was changed, the kprobe definition in profiler selftest in turn wasn't updated. The result is that all argument after the first are now stored in different registers. This means that self-test has been broken ever since. Fix it by updating the kprobe definition accordingly.

Quoted 6 lines

I don't see 6521f8917082 ("namei: prepare for idmapped mounts") in 5.10-stable tree. In 5.10, we still have:

include/linux/fs.h:extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);

I believe that means we should not have this one, either.

Good point, will go drop this, thanks.

greg k-h

Tested-by on the v1 series
#471 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.121 release. There are 452 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.121-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

5.10.121-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)

#146 lore raw

PATCH 1/1 bpf: Fix excessive memory allocation in stack_map_alloc()

In reply to Pavel Machek

The 'n_buckets * (value_size + sizeof(struct stack_map_bucket))' part of the allocated memory for 'smap' is never used, get rid of it.

Fixes b936ca643ade ("bpf: rework memlock-based memory accounting for maps")

---
This is the modified version for 5.10, the original patch is:

[ Upstream commit b45043192b3e481304062938a6561da2ceea46a6 ]

It would be better if the new patch can be reviewed by someone else.

 kernel/bpf/stackmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/stackmap.c +2 -2
index 4575d2d60cb1..54fdcb78ad19 100644
@@ -121,8 +121,8 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 		return ERR_PTR(-E2BIG);
 
 	cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
-	cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));
-	err = bpf_map_charge_init(&mem, cost);
+	err = bpf_map_charge_init(&mem, cost + n_buckets *
+				  (value_size + sizeof(struct stack_map_bucket)));
 	if (err)
 		return ERR_PTR(err);
 
Signature · 1 line
2.36.0
author maintainer
#147 lore raw

Re: [PATCH] bpf: Fix excessive memory allocation in stack_map_alloc()

Quoted 6 lines · Yuntao Wang

The 'n_buckets * (value_size + sizeof(struct stack_map_bucket))' part of the allocated memory for 'smap' is never used, get rid of it.

Fixes b936ca643ade ("bpf: rework memlock-based memory accounting for maps")
Quoted 6 lines

---
This is the modified version for 5.10, the original patch is:

[ Upstream commit b45043192b3e481304062938a6561da2ceea46a6 ]

It would be better if the new patch can be reviewed by someone else.

What is wrong with the version that we have queued up in the 5.10-stable review queue right now?

Quoted 9 lines
 kernel/bpf/stackmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/stackmap.c +0 -0
index 4575d2d60cb1..54fdcb78ad19 100644

kernel/bpf/stackmap.c static struct bpf_map *stack_map_alloc(union bpf_attr *attr) · line 125

Quoted 7 lines
kernel/bpf/stackmap.c +2 -2
@@ -121,8 +121,8 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 		return ERR_PTR(-E2BIG);
 
 	cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
-	cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));
-	err = bpf_map_charge_init(&mem, cost);
+	err = bpf_map_charge_init(&mem, cost + n_buckets *
+				  (value_size + sizeof(struct stack_map_bucket)));

This differs from what we have queued up for 5.4.y and 5.10.y, why? If you are going to modify the upstream version, you need to document in great detail what you have changed and why you have changed it.

thanks,

greg k-h

#148 lore raw

Re: [PATCH] bpf: Fix excessive memory allocation in stack_map_alloc()

Quoted 10 lines · Greg KH
Quoted 9 lines · Yuntao Wang

The 'n_buckets * (value_size + sizeof(struct stack_map_bucket))' part of the allocated memory for 'smap' is never used, get rid of it.

Fixes b936ca643ade ("bpf: rework memlock-based memory accounting for maps")

---
This is the modified version for 5.10, the original patch is:

Quoted 6 lines
Quoted 3 lines

[ Upstream commit b45043192b3e481304062938a6561da2ceea46a6 ]

It would be better if the new patch can be reviewed by someone else.

What is wrong with the version that we have queued up in the 5.10-stable review queue right now?

Since the 5.10 branch doesn't have commit 370868107bf6, the upstream version is not correct for it, I modified the original patch and wanted to backport it to the 5.10 branch.

Quoted 24 lines
Quoted 9 lines
 kernel/bpf/stackmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/stackmap.c +0 -0
index 4575d2d60cb1..54fdcb78ad19 100644

kernel/bpf/stackmap.c static struct bpf_map *stack_map_alloc(union bpf_attr *attr) · line 125

Quoted 7 lines
kernel/bpf/stackmap.c +2 -2
@@ -121,8 +121,8 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 		return ERR_PTR(-E2BIG);
 
 	cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
-	cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));
-	err = bpf_map_charge_init(&mem, cost);
+	err = bpf_map_charge_init(&mem, cost + n_buckets *
+				  (value_size + sizeof(struct stack_map_bucket)));

This differs from what we have queued up for 5.4.y and 5.10.y, why? If you are going to modify the upstream version, you need to document in great detail what you have changed and why you have changed it.

thanks,

greg k-h

Tested-by Linux Kernel Functional Testing on the v1 series
#472 lore raw
In reply to Greg Kroah-Hartman
Quoted 10 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.121 release. There are 452 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 8 lines
        https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.121-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.

thanks,

greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

## Build
* kernel: 5.10.121-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.10.y
* git commit: 08871e799a04f665596bafc8f6eec44c04286815
* git describe: v5.10.120-453-g08871e799a04
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.10.y/build/v5.10.120-453-g08871e799a04

## Test Regressions (compared to v5.10.120)
No test regressions found.

## Metric Regressions (compared to v5.10.120)
No metric regressions found.

## Test Fixes (compared to v5.10.120)
No test fixes found.

## Metric Fixes (compared to v5.10.120)
No metric fixes found.

## Test result summary
total: 137538, pass: 124480, fail: 212, skip: 12042, xfail: 804

## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 314 total, 314 passed, 0 failed
* arm64: 58 total, 58 passed, 0 failed
* i386: 52 total, 49 passed, 3 failed
* mips: 37 total, 37 passed, 0 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 51 total, 51 passed, 0 failed
* riscv: 27 total, 27 passed, 0 failed
* s390: 21 total, 21 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 56 total, 55 passed, 1 failed

## Test suites summary
* fwts
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-cap_bounds-tests
* ltp-commands
* ltp-commands-tests
* ltp-containers
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests
* ltp-fcntl-locktests-tests
* ltp-filecaps
* ltp-filecaps-tests
* ltp-fs
* ltp-fs-tests
* ltp-fs_bind
* ltp-fs_bind-tests
* ltp-fs_perms_simple
* ltp-fs_perms_simple-tests
* ltp-fsx
* ltp-fsx-tests
* ltp-hugetlb
* ltp-hugetlb-tests
* ltp-io
* ltp-io-tests
* ltp-ipc
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* perf/Zstd-perf.data-compression
* rcutorture
* ssuite
* v4l2-compliance
* vdso

--
Linaro LKFT
https://lkft.linaro.org

Tested-by on the v1 series
#473 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 5.10.121 release. There are 452 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Thu, 09 Jun 2022 16:48:02 +0000. Anything received after that time might be too late.

Build results:

	total: 163 pass: 163 fail: 0
Qemu test results:
	total: 477 pass: 477 fail: 0

Guenter

author maintainer
#149 lore raw

Re: [PATCH] bpf: Fix excessive memory allocation in stack_map_alloc()

In reply to Yuntao Wang
Quoted 13 lines · Yuntao Wang
Quoted 12 lines · Greg KH
Quoted 11 lines · Yuntao Wang

The 'n_buckets * (value_size + sizeof(struct stack_map_bucket))' part of the allocated memory for 'smap' is never used, get rid of it.

Fixes b936ca643ade ("bpf: rework memlock-based memory accounting for maps")

---
This is the modified version for 5.10, the original patch is:

[ Upstream commit b45043192b3e481304062938a6561da2ceea46a6 ]

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It would be better if the new patch can be reviewed by someone else.

What is wrong with the version that we have queued up in the 5.10-stable review queue right now?

Since the 5.10 branch doesn't have commit 370868107bf6, the upstream version is not correct for it, I modified the original patch and wanted to backport it to the 5.10 branch.

This does not apply to the 5.10 branch now, can you provide a working version?

thanks,

greg k-h

#150 lore raw

PATCH 1/1 bpf: Fix incorrect memory charge cost calculation in stack_map_alloc()

commit b45043192b3e481304062938a6561da2ceea46a6 upstream.

This is a backport of the original upstream patch for 5.4/5.10.

The original upstream patch has been applied to 5.4/5.10 branches, which simply removed the line:

  cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));

This is correct for upstream branch but incorrect for 5.4/5.10 branches, as the 5.4/5.10 branches do not have the commit 370868107bf6 ("bpf:
Eliminate rlimit-based memory accounting for stackmap maps"), so the bpf_map_charge_init() function has not been removed.

Currently the bpf_map_charge_init() function in 5.4/5.10 branches takes a wrong memory charge cost, the

attr->max_entries * (sizeof(struct stack_map_bucket) + (u64)value_size))

part is missing, let's fix it.

---
Note that the original upstream patch is currently applied to linux-stable-rc/linux-5.4.y branch, not linux/linux-5.4.y, this patch depends on that patch.

 kernel/bpf/stackmap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/bpf/stackmap.c +2 -1
index c19e669afba0..0c5bf98d5576 100644
@@ -121,7 +121,8 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 		return ERR_PTR(-E2BIG);
 
 	cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
-	err = bpf_map_charge_init(&mem, cost);
+	err = bpf_map_charge_init(&mem, cost + attr->max_entries *
+			   (sizeof(struct stack_map_bucket) + (u64)value_size));
 	if (err)
 		return ERR_PTR(err);
 
Signature · 1 line
2.36.0
author maintainer
#151 lore raw

Re: [PATCH] bpf: Fix incorrect memory charge cost calculation in stack_map_alloc()

Quoted 21 lines · Yuntao Wang

commit b45043192b3e481304062938a6561da2ceea46a6 upstream.

This is a backport of the original upstream patch for 5.4/5.10.

The original upstream patch has been applied to 5.4/5.10 branches, which simply removed the line:

  cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));

This is correct for upstream branch but incorrect for 5.4/5.10 branches, as the 5.4/5.10 branches do not have the commit 370868107bf6 ("bpf:
Eliminate rlimit-based memory accounting for stackmap maps"), so the bpf_map_charge_init() function has not been removed.

Currently the bpf_map_charge_init() function in 5.4/5.10 branches takes a wrong memory charge cost, the

attr->max_entries * (sizeof(struct stack_map_bucket) + (u64)value_size))

part is missing, let's fix it.

Quoted 7 lines

---
Note that the original upstream patch is currently applied to linux-stable-rc/linux-5.4.y branch, not linux/linux-5.4.y, this patch depends on that patch.

Now queued up, thanks.

greg k-h