From 2bfcec814cdf1572e2b58985b22ea655bf31076b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 19 Jun 2024 11:53:45 +0200 Subject: [PATCH] 5.15-stable patches added patches: hugetlb_encode.h-fix-undefined-behaviour-34-26.patch mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch mptcp-pm-update-add_addr-counters-after-connect.patch serial-8250_pxa-configure-tx_loadsz-to-match-fifo-irq-level.patch --- ...code.h-fix-undefined-behaviour-34-26.patch | 102 ++++++++++++++++ ...addr-mib-counter-once-per-rm_addr-id.patch | 77 ++++++++++++ ...date-add_addr-counters-after-connect.patch | 110 ++++++++++++++++++ ...re-tx_loadsz-to-match-fifo-irq-level.patch | 35 ++++++ queue-5.15/series | 4 + 5 files changed, 328 insertions(+) create mode 100644 queue-5.15/hugetlb_encode.h-fix-undefined-behaviour-34-26.patch create mode 100644 queue-5.15/mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch create mode 100644 queue-5.15/mptcp-pm-update-add_addr-counters-after-connect.patch create mode 100644 queue-5.15/serial-8250_pxa-configure-tx_loadsz-to-match-fifo-irq-level.patch diff --git a/queue-5.15/hugetlb_encode.h-fix-undefined-behaviour-34-26.patch b/queue-5.15/hugetlb_encode.h-fix-undefined-behaviour-34-26.patch new file mode 100644 index 00000000000..510eaa9c007 --- /dev/null +++ b/queue-5.15/hugetlb_encode.h-fix-undefined-behaviour-34-26.patch @@ -0,0 +1,102 @@ +From 710bb68c2e3a24512e2d2bae470960d7488e97b1 Mon Sep 17 00:00:00 2001 +From: Matthias Goergens +Date: Mon, 5 Sep 2022 11:19:04 +0800 +Subject: hugetlb_encode.h: fix undefined behaviour (34 << 26) + +From: Matthias Goergens + +commit 710bb68c2e3a24512e2d2bae470960d7488e97b1 upstream. + +Left-shifting past the size of your datatype is undefined behaviour in C. +The literal 34 gets the type `int`, and that one is not big enough to be +left shifted by 26 bits. + +An `unsigned` is long enough (on any machine that has at least 32 bits for +their ints.) + +For uniformity, we mark all the literals as unsigned. But it's only +really needed for HUGETLB_FLAG_ENCODE_16GB. + +Thanks to Randy Dunlap for an initial review and suggestion. + +Link: https://lkml.kernel.org/r/20220905031904.150925-1-matthias.goergens@gmail.com +Signed-off-by: Matthias Goergens +Acked-by: Randy Dunlap +Cc: Mike Kravetz +Cc: Muchun Song +Signed-off-by: Andrew Morton +Signed-off-by: Carlos Llamas +Signed-off-by: Greg Kroah-Hartman +--- + include/uapi/asm-generic/hugetlb_encode.h | 26 +++++++++++++------------- + tools/include/asm-generic/hugetlb_encode.h | 26 +++++++++++++------------- + 2 files changed, 26 insertions(+), 26 deletions(-) + +--- a/include/uapi/asm-generic/hugetlb_encode.h ++++ b/include/uapi/asm-generic/hugetlb_encode.h +@@ -20,18 +20,18 @@ + #define HUGETLB_FLAG_ENCODE_SHIFT 26 + #define HUGETLB_FLAG_ENCODE_MASK 0x3f + +-#define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_16KB (14U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_64KB (16U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_512KB (19U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_1MB (20U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_2MB (21U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_8MB (23U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_16MB (24U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_32MB (25U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_256MB (28U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_512MB (29U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_1GB (30U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_2GB (31U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_16GB (34U << HUGETLB_FLAG_ENCODE_SHIFT) + + #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */ +--- a/tools/include/asm-generic/hugetlb_encode.h ++++ b/tools/include/asm-generic/hugetlb_encode.h +@@ -20,18 +20,18 @@ + #define HUGETLB_FLAG_ENCODE_SHIFT 26 + #define HUGETLB_FLAG_ENCODE_MASK 0x3f + +-#define HUGETLB_FLAG_ENCODE_16KB (14 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_64KB (16 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_512KB (19 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_1MB (20 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT) +-#define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_16KB (14U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_64KB (16U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_512KB (19U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_1MB (20U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_2MB (21U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_8MB (23U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_16MB (24U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_32MB (25U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_256MB (28U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_512MB (29U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_1GB (30U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_2GB (31U << HUGETLB_FLAG_ENCODE_SHIFT) ++#define HUGETLB_FLAG_ENCODE_16GB (34U << HUGETLB_FLAG_ENCODE_SHIFT) + + #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */ diff --git a/queue-5.15/mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch b/queue-5.15/mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch new file mode 100644 index 00000000000..9a9a8669c11 --- /dev/null +++ b/queue-5.15/mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch @@ -0,0 +1,77 @@ +From 6a09788c1a66e3d8b04b3b3e7618cc817bb60ae9 Mon Sep 17 00:00:00 2001 +From: YonglongLi +Date: Fri, 7 Jun 2024 17:01:49 +0200 +Subject: mptcp: pm: inc RmAddr MIB counter once per RM_ADDR ID + +From: YonglongLi + +commit 6a09788c1a66e3d8b04b3b3e7618cc817bb60ae9 upstream. + +The RmAddr MIB counter is supposed to be incremented once when a valid +RM_ADDR has been received. Before this patch, it could have been +incremented as many times as the number of subflows connected to the +linked address ID, so it could have been 0, 1 or more than 1. + +The "RmSubflow" is incremented after a local operation. In this case, +it is normal to tied it with the number of subflows that have been +actually removed. + +The "remove invalid addresses" MP Join subtest has been modified to +validate this case. A broadcast IP address is now used instead: the +client will not be able to create a subflow to this address. The +consequence is that when receiving the RM_ADDR with the ID attached to +this broadcast IP address, no subflow linked to this ID will be found. + +Fixes: 7a7e52e38a40 ("mptcp: add RM_ADDR related mibs") +Cc: stable@vger.kernel.org +Co-developed-by: Matthieu Baerts (NGI0) +Signed-off-by: Matthieu Baerts (NGI0) +Signed-off-by: YonglongLi +Signed-off-by: Matthieu Baerts (NGI0) +Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-2-1ab9ddfa3d00@kernel.org +Signed-off-by: Jakub Kicinski +[ Conflicts in pm_netlink.c because the context has changed later in + multiple commits linked to new features, e.g. commit 86e39e04482b + ("mptcp: keep track of local endpoint still available for each msk"), + commit a88c9e496937 ("mptcp: do not block subflows creation on errors") + and commit 3ad14f54bd74 ("mptcp: more accurate MPC endpoint tracking"), + but the independent lines that needed to be modified were still there. + Conflicts in the selftests, because many features modifying the whole + file have been added later, e.g. commit ae7bd9ccecc3 ("selftests: + mptcp: join: option to execute specific tests"). The same + modifications have been reported to the old code: simply changing the + IP address and add a new comment. ] +Signed-off-by: Matthieu Baerts (NGI0) +Signed-off-by: Greg Kroah-Hartman +--- + net/mptcp/pm_netlink.c | 5 ++++- + tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +--- a/net/mptcp/pm_netlink.c ++++ b/net/mptcp/pm_netlink.c +@@ -757,8 +757,11 @@ static void mptcp_pm_nl_rm_addr_or_subfl + + removed = true; + msk->pm.subflows--; +- __MPTCP_INC_STATS(sock_net(sk), rm_type); ++ if (rm_type == MPTCP_MIB_RMSUBFLOW) ++ __MPTCP_INC_STATS(sock_net(sk), rm_type); + } ++ if (rm_type == MPTCP_MIB_RMADDR) ++ __MPTCP_INC_STATS(sock_net(sk), rm_type); + if (!removed) + continue; + +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -1307,7 +1307,8 @@ remove_tests() + ip netns exec $ns1 ./pm_nl_ctl limits 3 3 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal + ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal +- ip netns exec $ns1 ./pm_nl_ctl add 10.0.14.1 flags signal ++ # broadcast IP: no packet for this address will be received on ns1 ++ ip netns exec $ns1 ./pm_nl_ctl add 224.0.0.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 3 3 + run_tests $ns1 $ns2 10.0.1.1 0 -3 0 slow + chk_join_nr "remove invalid addresses" 1 1 1 diff --git a/queue-5.15/mptcp-pm-update-add_addr-counters-after-connect.patch b/queue-5.15/mptcp-pm-update-add_addr-counters-after-connect.patch new file mode 100644 index 00000000000..d2986fecbc0 --- /dev/null +++ b/queue-5.15/mptcp-pm-update-add_addr-counters-after-connect.patch @@ -0,0 +1,110 @@ +From 40eec1795cc27b076d49236649a29507c7ed8c2d Mon Sep 17 00:00:00 2001 +From: YonglongLi +Date: Fri, 7 Jun 2024 17:01:50 +0200 +Subject: mptcp: pm: update add_addr counters after connect + +From: YonglongLi + +commit 40eec1795cc27b076d49236649a29507c7ed8c2d upstream. + +The creation of new subflows can fail for different reasons. If no +subflow have been created using the received ADD_ADDR, the related +counters should not be updated, otherwise they will never be decremented +for events related to this ID later on. + +For the moment, the number of accepted ADD_ADDR is only decremented upon +the reception of a related RM_ADDR, and only if the remote address ID is +currently being used by at least one subflow. In other words, if no +subflow can be created with the received address, the counter will not +be decremented. In this case, it is then important not to increment +pm.add_addr_accepted counter, and not to modify pm.accept_addr bit. + +Note that this patch does not modify the behaviour in case of failures +later on, e.g. if the MP Join is dropped or rejected. + +The "remove invalid addresses" MP Join subtest has been modified to +validate this case. The broadcast IP address is added before the "valid" +address that will be used to successfully create a subflow, and the +limit is decreased by one: without this patch, it was not possible to +create the last subflow, because: + +- the broadcast address would have been accepted even if it was not + usable: the creation of a subflow to this address results in an error, + +- the limit of 2 accepted ADD_ADDR would have then been reached. + +Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") +Cc: stable@vger.kernel.org +Co-developed-by: Matthieu Baerts (NGI0) +Signed-off-by: Matthieu Baerts (NGI0) +Signed-off-by: YonglongLi +Reviewed-by: Mat Martineau +Signed-off-by: Matthieu Baerts (NGI0) +Link: https://lore.kernel.org/r/20240607-upstream-net-20240607-misc-fixes-v1-3-1ab9ddfa3d00@kernel.org +Signed-off-by: Jakub Kicinski +[ Conflicts in pm_netlink.c because commit 12a18341b5c3 ("mptcp: send + ADD_ADDR echo before create subflows") is not present in this version, + and it changes the context, but not the block that needs to be moved. + Conflicts in the selftests, because many features modifying the whole + file have been added later, e.g. commit ae7bd9ccecc3 ("selftests: + mptcp: join: option to execute specific tests"). The same + modifications have been reported to the old code: simply moving one + line, and changing the limits. ] +Signed-off-by: Matthieu Baerts (NGI0) +Signed-off-by: Greg Kroah-Hartman +--- + net/mptcp/pm_netlink.c | 16 ++++++++++------ + tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++-- + 2 files changed, 12 insertions(+), 8 deletions(-) + +--- a/net/mptcp/pm_netlink.c ++++ b/net/mptcp/pm_netlink.c +@@ -608,6 +608,7 @@ static void mptcp_pm_nl_add_addr_receive + struct mptcp_addr_info remote; + unsigned int subflows_max; + bool reset_port = false; ++ bool sf_created = false; + int i, nr; + + add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); +@@ -632,16 +633,19 @@ static void mptcp_pm_nl_add_addr_receive + */ + nr = fill_local_addresses_vec(msk, addrs); + +- msk->pm.add_addr_accepted++; +- if (msk->pm.add_addr_accepted >= add_addr_accept_max || +- msk->pm.subflows >= subflows_max) +- WRITE_ONCE(msk->pm.accept_addr, false); +- + spin_unlock_bh(&msk->pm.lock); + for (i = 0; i < nr; i++) +- __mptcp_subflow_connect(sk, &addrs[i], &remote); ++ if (__mptcp_subflow_connect(sk, &addrs[i], &remote) == 0) ++ sf_created = true; + spin_lock_bh(&msk->pm.lock); + ++ if (sf_created) { ++ msk->pm.add_addr_accepted++; ++ if (msk->pm.add_addr_accepted >= add_addr_accept_max || ++ msk->pm.subflows >= subflows_max) ++ WRITE_ONCE(msk->pm.accept_addr, false); ++ } ++ + /* be sure to echo exactly the received address */ + if (reset_port) + remote.port = 0; +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -1306,10 +1306,10 @@ remove_tests() + reset + ip netns exec $ns1 ./pm_nl_ctl limits 3 3 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal +- ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal + # broadcast IP: no packet for this address will be received on ns1 + ip netns exec $ns1 ./pm_nl_ctl add 224.0.0.1 flags signal +- ip netns exec $ns2 ./pm_nl_ctl limits 3 3 ++ ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal ++ ip netns exec $ns2 ./pm_nl_ctl limits 2 2 + run_tests $ns1 $ns2 10.0.1.1 0 -3 0 slow + chk_join_nr "remove invalid addresses" 1 1 1 + chk_add_nr 3 3 diff --git a/queue-5.15/serial-8250_pxa-configure-tx_loadsz-to-match-fifo-irq-level.patch b/queue-5.15/serial-8250_pxa-configure-tx_loadsz-to-match-fifo-irq-level.patch new file mode 100644 index 00000000000..0412d09edc3 --- /dev/null +++ b/queue-5.15/serial-8250_pxa-configure-tx_loadsz-to-match-fifo-irq-level.patch @@ -0,0 +1,35 @@ +From 5208e7ced520a813b4f4774451fbac4e517e78b2 Mon Sep 17 00:00:00 2001 +From: Doug Brown +Date: Sun, 19 May 2024 12:19:30 -0700 +Subject: serial: 8250_pxa: Configure tx_loadsz to match FIFO IRQ level + +From: Doug Brown + +commit 5208e7ced520a813b4f4774451fbac4e517e78b2 upstream. + +The FIFO is 64 bytes, but the FCR is configured to fire the TX interrupt +when the FIFO is half empty (bit 3 = 0). Thus, we should only write 32 +bytes when a TX interrupt occurs. + +This fixes a problem observed on the PXA168 that dropped a bunch of TX +bytes during large transmissions. + +Fixes: ab28f51c77cd ("serial: rewrite pxa2xx-uart to use 8250_core") +Signed-off-by: Doug Brown +Link: https://lore.kernel.org/r/20240519191929.122202-1-doug@schmorgal.com +Cc: stable +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_pxa.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/tty/serial/8250/8250_pxa.c ++++ b/drivers/tty/serial/8250/8250_pxa.c +@@ -125,6 +125,7 @@ static int serial_pxa_probe(struct platf + uart.port.regshift = 2; + uart.port.irq = irq; + uart.port.fifosize = 64; ++ uart.tx_loadsz = 32; + uart.port.flags = UPF_IOREMAP | UPF_SKIP_TEST | UPF_FIXED_TYPE; + uart.port.dev = &pdev->dev; + uart.port.uartclk = clk_get_rate(data->clk); diff --git a/queue-5.15/series b/queue-5.15/series index 163100bc37b..7ee2c13c78d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -166,3 +166,7 @@ nilfs2-fix-potential-kernel-bug-due-to-lack-of-writeback-flag-waiting.patch tick-nohz_full-don-t-abuse-smp_call_function_single-in-tick_setup_device.patch scsi-mpi3mr-fix-ata-ncq-priority-support.patch mm-huge_memory-don-t-unpoison-huge_zero_folio.patch +serial-8250_pxa-configure-tx_loadsz-to-match-fifo-irq-level.patch +hugetlb_encode.h-fix-undefined-behaviour-34-26.patch +mptcp-pm-inc-rmaddr-mib-counter-once-per-rm_addr-id.patch +mptcp-pm-update-add_addr-counters-after-connect.patch -- 2.47.3