From 0e65974478ed29411810a1323910a125006b2e33 Mon Sep 17 00:00:00 2001 From: ZhangPeng Date: Tue, 24 Dec 2024 17:32:41 +0800 Subject: [PATCH] Fix kabi broken for 24.03-LTS Signed-off-by: ZhangPeng --- ...e-kabi-KABI-reservation-for-seq_file.patch | 43 +++++ ...tatx-kabi-KABI-reservation-for-kstat.patch | 45 +++++ ...abi-Reserve-space-for-net-structures.patch | 84 ++++++++ ...reserve-space-for-xdp-subsystem-rela.patch | 80 ++++++++ ...erve-extra-KABI-entry-for-struct-iop.patch | 37 ++++ ...g-Enable-CONFIG_CMA-by-default-in-op.patch | 58 ++++++ ...ig-Select-CONFIG_CMA-if-CONFIG_HYGON.patch | 34 ++++ ...ude-msi-modify-kabi-size-of-msi_desc.patch | 45 +++++ ...-fine-grained-control-of-folio-sizes.patch | 180 ++++++++++++++++++ ...-Revert-cgroup-add-more-reserve-kabi.patch | 90 +++++++++ ...uset-Prevent-UAF-in-proc_cpuset_show.patch | 53 ++++++ ...ve-rcu_head-up-near-the-top-of-cgrou.patch | 48 +++++ ...ke-operations-on-the-cgroup-root_lis.patch | 126 ++++++++++++ ...cgroup-fix-uaf-when-proc_cpuset_show.patch | 66 +++++++ 0019-Revert-kabi-reserver-space-for-i2c.patch | 35 ++++ ...ert-kabi-reserve-space-for-uprobes.h.patch | 48 +++++ ...rt-kabi-reserve-space-for-internal.h.patch | 49 +++++ ...-kabi-reserve-space-for-perf_event.h.patch | 55 ++++++ ...abi-reserve-padding-for-uapi-struct-.patch | 63 ++++++ kernel.spec | 44 ++++- 20 files changed, 1282 insertions(+), 1 deletion(-) create mode 100644 0005-Revert-seq_file-kabi-KABI-reservation-for-seq_file.patch create mode 100644 0006-Revert-statx-kabi-KABI-reservation-for-kstat.patch create mode 100644 0007-Revert-net-kabi-Reserve-space-for-net-structures.patch create mode 100644 0008-Revert-kabi-net-reserve-space-for-xdp-subsystem-rela.patch create mode 100644 0009-Revert-iommu-Reserve-extra-KABI-entry-for-struct-iop.patch create mode 100644 0010-Revert-x86-config-Enable-CONFIG_CMA-by-default-in-op.patch create mode 100644 0011-Revert-x86-Kconfig-Select-CONFIG_CMA-if-CONFIG_HYGON.patch create mode 100644 0012-Revert-include-msi-modify-kabi-size-of-msi_desc.patch create mode 100644 0013-Revert-fs-Allow-fine-grained-control-of-folio-sizes.patch create mode 100644 0014-Revert-cgroup-add-more-reserve-kabi.patch create mode 100644 0015-Revert-cgroup-cpuset-Prevent-UAF-in-proc_cpuset_show.patch create mode 100644 0016-Revert-cgroup-Move-rcu_head-up-near-the-top-of-cgrou.patch create mode 100644 0017-Revert-cgroup-Make-operations-on-the-cgroup-root_lis.patch create mode 100644 0018-Revert-Revert-cgroup-fix-uaf-when-proc_cpuset_show.patch create mode 100644 0019-Revert-kabi-reserver-space-for-i2c.patch create mode 100644 0020-Revert-kabi-reserve-space-for-uprobes.h.patch create mode 100644 0021-Revert-kabi-reserve-space-for-internal.h.patch create mode 100644 0022-Revert-kabi-reserve-space-for-perf_event.h.patch create mode 100644 0023-Revert-bpf-Add-kabi-reserve-padding-for-uapi-struct-.patch diff --git a/0005-Revert-seq_file-kabi-KABI-reservation-for-seq_file.patch b/0005-Revert-seq_file-kabi-KABI-reservation-for-seq_file.patch new file mode 100644 index 0000000..8315164 --- /dev/null +++ b/0005-Revert-seq_file-kabi-KABI-reservation-for-seq_file.patch @@ -0,0 +1,43 @@ +From 1c9156beccdfee62f03dcdad407585927420c0cd Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:27:27 +0800 +Subject: [PATCH 05/23] Revert "seq_file: kabi: KABI reservation for seq_file" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 45a269b6bc9db79ec770ce7c64515d15ee547a3a. + +Signed-off-by: ZhangPeng +--- + include/linux/seq_file.h | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h +index cf4a2258df85..234bcdb1fba4 100644 +--- a/include/linux/seq_file.h ++++ b/include/linux/seq_file.h +@@ -27,8 +27,6 @@ struct seq_file { + int poll_event; + const struct file *file; + void *private; +- +- KABI_RESERVE(1) + }; + + struct seq_operations { +@@ -36,8 +34,6 @@ struct seq_operations { + void (*stop) (struct seq_file *m, void *v); + void * (*next) (struct seq_file *m, void *v, loff_t *pos); + int (*show) (struct seq_file *m, void *v); +- +- KABI_RESERVE(1) + }; + + #define SEQ_SKIP 1 +-- +2.25.1 + diff --git a/0006-Revert-statx-kabi-KABI-reservation-for-kstat.patch b/0006-Revert-statx-kabi-KABI-reservation-for-kstat.patch new file mode 100644 index 0000000..a1e7c99 --- /dev/null +++ b/0006-Revert-statx-kabi-KABI-reservation-for-kstat.patch @@ -0,0 +1,45 @@ +From b9f0c11f5f150b271814ec2b59fa85f2396a0b52 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:42:14 +0800 +Subject: [PATCH 06/23] Revert "statx: kabi: KABI reservation for kstat" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 7388fea23fccb98dbed580f41cc0037b7a1d66de. + +Signed-off-by: ZhangPeng +--- + include/linux/stat.h | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/include/linux/stat.h b/include/linux/stat.h +index 045064370cd8..52150570d37a 100644 +--- a/include/linux/stat.h ++++ b/include/linux/stat.h +@@ -18,7 +18,6 @@ + #include + #include + #include +-#include + + struct kstat { + u32 result_mask; /* What fields the user got */ +@@ -54,11 +53,6 @@ struct kstat { + u32 dio_mem_align; + u32 dio_offset_align; + u64 change_cookie; +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + /* These definitions are internal to the kernel for now. Mainly used by nfsd. */ +-- +2.25.1 + diff --git a/0007-Revert-net-kabi-Reserve-space-for-net-structures.patch b/0007-Revert-net-kabi-Reserve-space-for-net-structures.patch new file mode 100644 index 0000000..30cdbb2 --- /dev/null +++ b/0007-Revert-net-kabi-Reserve-space-for-net-structures.patch @@ -0,0 +1,84 @@ +From 93310d0377413e2f3e3625983143a5414ee2eafa Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:43:15 +0800 +Subject: [PATCH 07/23] Revert "net/kabi: Reserve space for net structures" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit a2bbb3a7e3d30f5efc443fa17fcfe20fdd5a98d5. + +Signed-off-by: ZhangPeng +--- + include/net/flow.h | 2 -- + include/net/netns/netfilter.h | 2 -- + include/net/netns/xfrm.h | 2 -- + include/net/xfrm.h | 4 ---- + 4 files changed, 10 deletions(-) + +diff --git a/include/net/flow.h b/include/net/flow.h +index 72d2ea2374ba..0cc5f2ef1000 100644 +--- a/include/net/flow.h ++++ b/include/net/flow.h +@@ -46,8 +46,6 @@ struct flowi_common { + + KABI_RESERVE(1) + KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + union flowi_uli { +diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h +index 963588269637..4b77a9b031b6 100644 +--- a/include/net/netns/netfilter.h ++++ b/include/net/netns/netfilter.h +@@ -34,7 +34,5 @@ struct netns_nf { + + KABI_RESERVE(1) + KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + #endif +diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h +index af7f20ef4823..a0c1359cc7eb 100644 +--- a/include/net/netns/xfrm.h ++++ b/include/net/netns/xfrm.h +@@ -87,8 +87,6 @@ struct netns_xfrm { + + KABI_RESERVE(1) + KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + #endif +diff --git a/include/net/xfrm.h b/include/net/xfrm.h +index b9dec5f9c973..c875faf98492 100644 +--- a/include/net/xfrm.h ++++ b/include/net/xfrm.h +@@ -294,8 +294,6 @@ struct xfrm_state { + + KABI_RESERVE(1) + KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + static inline struct net *xs_net(struct xfrm_state *x) +@@ -564,8 +562,6 @@ struct xfrm_policy { + + KABI_RESERVE(1) + KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + static inline struct net *xp_net(const struct xfrm_policy *xp) +-- +2.25.1 + diff --git a/0008-Revert-kabi-net-reserve-space-for-xdp-subsystem-rela.patch b/0008-Revert-kabi-net-reserve-space-for-xdp-subsystem-rela.patch new file mode 100644 index 0000000..0a232da --- /dev/null +++ b/0008-Revert-kabi-net-reserve-space-for-xdp-subsystem-rela.patch @@ -0,0 +1,80 @@ +From cf35f7af0a3fbab7c799d0a5b160f5a39d8e1f31 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:43:50 +0800 +Subject: [PATCH 08/23] Revert "kabi: net: reserve space for xdp subsystem + related structure" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit f8cb61566576a623971d5cc8dd3cd6229e787e30. + +Signed-off-by: ZhangPeng +--- + include/net/xdp.h | 19 ------------------- + 1 file changed, 19 deletions(-) + +diff --git a/include/net/xdp.h b/include/net/xdp.h +index 9b9c7dc25eeb..c283668458ca 100644 +--- a/include/net/xdp.h ++++ b/include/net/xdp.h +@@ -54,9 +54,6 @@ enum xdp_mem_type { + struct xdp_mem_info { + u32 type; /* enum xdp_mem_type, but known size type */ + u32 id; +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) + }; + + struct page_pool; +@@ -77,9 +74,6 @@ struct xdp_rxq_info { + + struct xdp_txq_info { + struct net_device *dev; +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) + }; + + enum xdp_buff_flags { +@@ -98,11 +92,6 @@ struct xdp_buff { + struct xdp_txq_info *txq; + u32 frame_sz; /* frame size to deduce data_hard_end/reserved tailroom*/ + u32 flags; /* supported values defined in xdp_buff_flags */ +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + static __always_inline bool xdp_buff_has_frags(struct xdp_buff *xdp) +@@ -192,11 +181,6 @@ struct xdp_frame { + struct net_device *dev_rx; /* used by cpumap */ + u32 frame_sz; + u32 flags; /* supported values defined in xdp_buff_flags */ +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + }; + + static __always_inline bool xdp_frame_has_frags(struct xdp_frame *frame) +@@ -214,9 +198,6 @@ struct xdp_frame_bulk { + int count; + void *xa; + void *q[XDP_BULK_QUEUE_SIZE]; +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) + }; + + static __always_inline void xdp_frame_bulk_init(struct xdp_frame_bulk *bq) +-- +2.25.1 + diff --git a/0009-Revert-iommu-Reserve-extra-KABI-entry-for-struct-iop.patch b/0009-Revert-iommu-Reserve-extra-KABI-entry-for-struct-iop.patch new file mode 100644 index 0000000..a8d368f --- /dev/null +++ b/0009-Revert-iommu-Reserve-extra-KABI-entry-for-struct-iop.patch @@ -0,0 +1,37 @@ +From 7f64de266ef1aa56adc82ec55aa787fbc83e0251 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:44:12 +0800 +Subject: [PATCH 09/23] Revert "iommu: Reserve extra KABI entry for struct + iopf_group" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 6b0247f6d557172711097fd402d1a5ba63b258fc. + +Signed-off-by: ZhangPeng +--- + include/linux/iommu.h | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/include/linux/iommu.h b/include/linux/iommu.h +index 83ec4bf9809e..bb463cb96a44 100644 +--- a/include/linux/iommu.h ++++ b/include/linux/iommu.h +@@ -155,10 +155,6 @@ struct iopf_group { + KABI_USE(2, u32 cookie) + KABI_RESERVE(3) + KABI_RESERVE(4) +- KABI_RESERVE(5) +- KABI_RESERVE(6) +- KABI_RESERVE(7) +- KABI_RESERVE(8) + }; + + struct iopf_group_extend { +-- +2.25.1 + diff --git a/0010-Revert-x86-config-Enable-CONFIG_CMA-by-default-in-op.patch b/0010-Revert-x86-config-Enable-CONFIG_CMA-by-default-in-op.patch new file mode 100644 index 0000000..2fcd20b --- /dev/null +++ b/0010-Revert-x86-config-Enable-CONFIG_CMA-by-default-in-op.patch @@ -0,0 +1,58 @@ +From 8e55b4465cb45eadc9391b3d3fe8787bc9348a6e Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:44:36 +0800 +Subject: [PATCH 10/23] Revert "x86/config: Enable CONFIG_CMA by default in + openeuler_defconfig" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 9ecfe480c6fef496105360baa430103754f31bdf. + +Signed-off-by: ZhangPeng +--- + arch/x86/configs/openeuler_defconfig | 18 +----------------- + 1 file changed, 1 insertion(+), 17 deletions(-) + +diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig +index adfaef0cb10c..8e8542796a13 100644 +--- a/arch/x86/configs/openeuler_defconfig ++++ b/arch/x86/configs/openeuler_defconfig +@@ -1158,11 +1158,7 @@ CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y + CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y + CONFIG_USE_PERCPU_NUMA_NODE_ID=y + CONFIG_HAVE_SETUP_PER_CPU_AREA=y +-CONFIG_CMA=y +-# CONFIG_CMA_DEBUG is not set +-# CONFIG_CMA_DEBUGFS is not set +-# CONFIG_CMA_SYSFS is not set +-CONFIG_CMA_AREAS=19 ++# CONFIG_CMA is not set + CONFIG_MEM_SOFT_DIRTY=y + CONFIG_GENERIC_EARLY_IOREMAP=y + CONFIG_DEFERRED_STRUCT_PAGE_INIT=y +@@ -9022,18 +9018,6 @@ CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED=y + CONFIG_SWIOTLB=y + # CONFIG_SWIOTLB_DYNAMIC is not set + CONFIG_DMA_COHERENT_POOL=y +-CONFIG_DMA_CMA=y +-# CONFIG_DMA_NUMA_CMA is not set +- +-# +-# Default contiguous memory area size: +-# +-CONFIG_CMA_SIZE_MBYTES=0 +-CONFIG_CMA_SIZE_SEL_MBYTES=y +-# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set +-# CONFIG_CMA_SIZE_SEL_MIN is not set +-# CONFIG_CMA_SIZE_SEL_MAX is not set +-CONFIG_CMA_ALIGNMENT=8 + # CONFIG_DMA_API_DEBUG is not set + # CONFIG_DMA_MAP_BENCHMARK is not set + CONFIG_SGL_ALLOC=y +-- +2.25.1 + diff --git a/0011-Revert-x86-Kconfig-Select-CONFIG_CMA-if-CONFIG_HYGON.patch b/0011-Revert-x86-Kconfig-Select-CONFIG_CMA-if-CONFIG_HYGON.patch new file mode 100644 index 0000000..8106e24 --- /dev/null +++ b/0011-Revert-x86-Kconfig-Select-CONFIG_CMA-if-CONFIG_HYGON.patch @@ -0,0 +1,34 @@ +From 96d192b804267d52287c071ceb1827fdebcf7993 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:44:56 +0800 +Subject: [PATCH 11/23] Revert "x86/Kconfig: Select CONFIG_CMA if + CONFIG_HYGON_CSV=y" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 6199dbe536bf6a8bbc08c6dae07a40c702aa6813. + +Signed-off-by: ZhangPeng +--- + arch/x86/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index a6bbe6029121..fcd0c3b2065d 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -2075,7 +2075,6 @@ config HYGON_CSV + bool "Hygon secure virtualization CSV support" + default y + depends on CPU_SUP_HYGON && AMD_MEM_ENCRYPT +- select CONFIG_CMA + help + Hygon CSV integrates secure processor, memory encryption and + memory isolation to provide the ability to protect guest's private +-- +2.25.1 + diff --git a/0012-Revert-include-msi-modify-kabi-size-of-msi_desc.patch b/0012-Revert-include-msi-modify-kabi-size-of-msi_desc.patch new file mode 100644 index 0000000..5a99a18 --- /dev/null +++ b/0012-Revert-include-msi-modify-kabi-size-of-msi_desc.patch @@ -0,0 +1,45 @@ +From 1cc8fb49c9e4295511b181e6caca4539368ab3d8 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:45:34 +0800 +Subject: [PATCH 12/23] Revert "include/msi: modify kabi size of msi_desc" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 6504f0172e640d6507dd5d2ce61e0c4d7ba3af56. + +Signed-off-by: ZhangPeng +--- + include/linux/msi.h | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/include/linux/msi.h b/include/linux/msi.h +index 5fd8a6caae98..7354ffb14856 100644 +--- a/include/linux/msi.h ++++ b/include/linux/msi.h +@@ -205,12 +205,15 @@ struct msi_desc { + union { + struct pci_msi_desc pci; + struct msi_desc_data data; +- KABI_EXTEND_WITH_SIZE(KABI_RESERVE(1), 5) ++ KABI_RESERVE(1) ++ KABI_RESERVE(2) ++ KABI_RESERVE(3) ++ KABI_RESERVE(4) + }; +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) + KABI_RESERVE(5) ++ KABI_RESERVE(6) ++ KABI_RESERVE(7) ++ KABI_RESERVE(8) + }; + + /* +-- +2.25.1 + diff --git a/0013-Revert-fs-Allow-fine-grained-control-of-folio-sizes.patch b/0013-Revert-fs-Allow-fine-grained-control-of-folio-sizes.patch new file mode 100644 index 0000000..66a7d27 --- /dev/null +++ b/0013-Revert-fs-Allow-fine-grained-control-of-folio-sizes.patch @@ -0,0 +1,180 @@ +From 11840788815d6d0459ae6911b8f8ba5d11928a87 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:45:56 +0800 +Subject: [PATCH 13/23] Revert "fs: Allow fine-grained control of folio sizes" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit e6ebbdef6b5db01872e4c5866d333cb2f923be57. + +Signed-off-by: ZhangPeng +--- + include/linux/pagemap.h | 90 ++++++----------------------------------- + mm/readahead.c | 4 +- + 2 files changed, 15 insertions(+), 79 deletions(-) + +diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h +index e44e377661f2..429627abfef4 100644 +--- a/include/linux/pagemap.h ++++ b/include/linux/pagemap.h +@@ -203,21 +203,12 @@ enum mapping_flags { + AS_EXITING = 4, /* final truncate in progress */ + /* writeback related tags are not used */ + AS_NO_WRITEBACK_TAGS = 5, +- AS_RELEASE_ALWAYS = 6, /* Call ->release_folio(), even if no private data */ +- AS_STABLE_WRITES = 7, /* must wait for writeback before modifying ++ AS_LARGE_FOLIO_SUPPORT = 6, ++ AS_RELEASE_ALWAYS, /* Call ->release_folio(), even if no private data */ ++ AS_STABLE_WRITES, /* must wait for writeback before modifying + folio contents */ +- AS_INACCESSIBLE = 8, /* Do not attempt direct R/W access to the mapping */ +- /* Bits 16-25 are used for FOLIO_ORDER */ +- AS_FOLIO_ORDER_BITS = 5, +- AS_FOLIO_ORDER_MIN = 16, +- AS_FOLIO_ORDER_MAX = AS_FOLIO_ORDER_MIN + AS_FOLIO_ORDER_BITS, + }; + +-#define AS_FOLIO_ORDER_BITS_MASK ((1u << AS_FOLIO_ORDER_BITS) - 1) +-#define AS_FOLIO_ORDER_MIN_MASK (AS_FOLIO_ORDER_BITS_MASK << AS_FOLIO_ORDER_MIN) +-#define AS_FOLIO_ORDER_MAX_MASK (AS_FOLIO_ORDER_BITS_MASK << AS_FOLIO_ORDER_MAX) +-#define AS_FOLIO_ORDER_MASK (AS_FOLIO_ORDER_MIN_MASK | AS_FOLIO_ORDER_MAX_MASK) +- + /** + * mapping_set_error - record a writeback error in the address_space + * @mapping: the mapping in which an error should be set +@@ -357,51 +348,9 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) + #define MAX_XAS_ORDER (XA_CHUNK_SHIFT * 2 - 1) + #define MAX_PAGECACHE_ORDER min(MAX_XAS_ORDER, PREFERRED_MAX_PAGECACHE_ORDER) + +-/* +- * mapping_set_folio_order_range() - Set the orders supported by a file. +- * @mapping: The address space of the file. +- * @min: Minimum folio order (between 0-MAX_PAGECACHE_ORDER inclusive). +- * @max: Maximum folio order (between @min-MAX_PAGECACHE_ORDER inclusive). +- * +- * The filesystem should call this function in its inode constructor to +- * indicate which base size (min) and maximum size (max) of folio the VFS +- * can use to cache the contents of the file. This should only be used +- * if the filesystem needs special handling of folio sizes (ie there is +- * something the core cannot know). +- * Do not tune it based on, eg, i_size. +- * +- * Context: This should not be called while the inode is active as it +- * is non-atomic. +- */ +-static inline void mapping_set_folio_order_range(struct address_space *mapping, +- unsigned int min, +- unsigned int max) +-{ +- if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) +- return; +- +- if (min > MAX_PAGECACHE_ORDER) +- min = MAX_PAGECACHE_ORDER; +- +- if (max > MAX_PAGECACHE_ORDER) +- max = MAX_PAGECACHE_ORDER; +- +- if (max < min) +- max = min; +- +- mapping->flags = (mapping->flags & ~AS_FOLIO_ORDER_MASK) | +- (min << AS_FOLIO_ORDER_MIN) | (max << AS_FOLIO_ORDER_MAX); +-} +- +-static inline void mapping_set_folio_min_order(struct address_space *mapping, +- unsigned int min) +-{ +- mapping_set_folio_order_range(mapping, min, MAX_PAGECACHE_ORDER); +-} +- + /** + * mapping_set_large_folios() - Indicate the file supports large folios. +- * @mapping: The address space of the file. ++ * @mapping: The file. + * + * The filesystem should call this function in its inode constructor to + * indicate that the VFS can use large folios to cache the contents of +@@ -412,23 +361,7 @@ static inline void mapping_set_folio_min_order(struct address_space *mapping, + */ + static inline void mapping_set_large_folios(struct address_space *mapping) + { +- mapping_set_folio_order_range(mapping, 0, MAX_PAGECACHE_ORDER); +-} +- +-static inline unsigned int +-mapping_max_folio_order(const struct address_space *mapping) +-{ +- if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) +- return 0; +- return (mapping->flags & AS_FOLIO_ORDER_MAX_MASK) >> AS_FOLIO_ORDER_MAX; +-} +- +-static inline unsigned int +-mapping_min_folio_order(const struct address_space *mapping) +-{ +- if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) +- return 0; +- return (mapping->flags & AS_FOLIO_ORDER_MIN_MASK) >> AS_FOLIO_ORDER_MIN; ++ __set_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + } + + /** +@@ -442,7 +375,7 @@ mapping_min_folio_order(const struct address_space *mapping) + static inline void mapping_clear_large_folios(struct address_space *mapping) + { + WARN_ON_ONCE(!rwsem_is_locked(&mapping->invalidate_lock)); +- mapping_set_folio_order_range(mapping, 0, 0); ++ __clear_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + } + + /* +@@ -451,17 +384,20 @@ static inline void mapping_clear_large_folios(struct address_space *mapping) + */ + static inline bool mapping_large_folio_support(struct address_space *mapping) + { +- /* AS_FOLIO_ORDER is only reasonable for pagecache folios */ ++ /* AS_LARGE_FOLIO_SUPPORT is only reasonable for pagecache folios */ + VM_WARN_ONCE((unsigned long)mapping & PAGE_MAPPING_ANON, + "Anonymous mapping always supports large folio"); + +- return mapping_max_folio_order(mapping) > 0; ++ return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && ++ test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags); + } + + /* Return the maximum folio size for this pagecache mapping, in bytes. */ +-static inline size_t mapping_max_folio_size(const struct address_space *mapping) ++static inline size_t mapping_max_folio_size(struct address_space *mapping) + { +- return PAGE_SIZE << mapping_max_folio_order(mapping); ++ if (mapping_large_folio_support(mapping)) ++ return PAGE_SIZE << MAX_PAGECACHE_ORDER; ++ return PAGE_SIZE; + } + + static inline int filemap_nr_thps(struct address_space *mapping) +diff --git a/mm/readahead.c b/mm/readahead.c +index c13c130efcca..438f142a3e74 100644 +--- a/mm/readahead.c ++++ b/mm/readahead.c +@@ -513,10 +513,10 @@ void page_cache_ra_order(struct readahead_control *ractl, + + limit = min(limit, index + ra->size - 1); + +- if (new_order < mapping_max_folio_order(mapping)) ++ if (new_order < MAX_PAGECACHE_ORDER) + new_order += 2; + +- new_order = min(mapping_max_folio_order(mapping), new_order); ++ new_order = min_t(unsigned int, MAX_PAGECACHE_ORDER, new_order); + new_order = min_t(unsigned int, new_order, ilog2(ra->size)); + + /* See comment in page_cache_ra_unbounded() */ +-- +2.25.1 + diff --git a/0014-Revert-cgroup-add-more-reserve-kabi.patch b/0014-Revert-cgroup-add-more-reserve-kabi.patch new file mode 100644 index 0000000..e29e360 --- /dev/null +++ b/0014-Revert-cgroup-add-more-reserve-kabi.patch @@ -0,0 +1,90 @@ +From c16fd333dde352930e1255f432e8dfeeef7dfc82 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:46:46 +0800 +Subject: [PATCH 14/23] Revert "cgroup: add more reserve kabi" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 9d62feb292370f2b6d78264613019f7feb7cca4e. + +Signed-off-by: ZhangPeng +--- + include/linux/cgroup-defs.h | 7 ------- + include/linux/memcontrol.h | 8 -------- + kernel/cgroup/cpuset.c | 5 +++++ + 3 files changed, 5 insertions(+), 15 deletions(-) + +diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h +index f3fd0407d346..8eb518ce87a1 100644 +--- a/include/linux/cgroup-defs.h ++++ b/include/linux/cgroup-defs.h +@@ -325,8 +325,6 @@ struct cgroup_base_stat { + #ifdef CONFIG_SCHED_CORE + u64 forceidle_sum; + #endif +- KABI_RESERVE(1) +- KABI_RESERVE(2) + }; + + /* +@@ -557,9 +555,6 @@ struct cgroup { + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) +- KABI_RESERVE(6) +- KABI_RESERVE(7) +- KABI_RESERVE(8) + /* All ancestors including self */ + struct cgroup *ancestors[]; + }; +@@ -611,8 +606,6 @@ struct cgroup_root { + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) +- KABI_RESERVE(5) +- KABI_RESERVE(6) + }; + + /* +diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h +index abe236201e68..b2a80e089a0a 100644 +--- a/include/linux/memcontrol.h ++++ b/include/linux/memcontrol.h +@@ -429,14 +429,6 @@ struct mem_cgroup { + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) +- KABI_RESERVE(9) +- KABI_RESERVE(10) +- KABI_RESERVE(11) +- KABI_RESERVE(12) +- KABI_RESERVE(13) +- KABI_RESERVE(14) +- KABI_RESERVE(15) +- KABI_RESERVE(16) + struct mem_cgroup_per_node *nodeinfo[]; + }; + +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c +index 7ea0a6d00519..f3cf9b1268e0 100644 +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -211,6 +211,11 @@ struct cpuset { + + /* Remote partition silbling list anchored at remote_children */ + struct list_head remote_sibling; ++ ++ KABI_RESERVE(1) ++ KABI_RESERVE(2) ++ KABI_RESERVE(3) ++ KABI_RESERVE(4) + }; + + /* +-- +2.25.1 + diff --git a/0015-Revert-cgroup-cpuset-Prevent-UAF-in-proc_cpuset_show.patch b/0015-Revert-cgroup-cpuset-Prevent-UAF-in-proc_cpuset_show.patch new file mode 100644 index 0000000..bd5e9f7 --- /dev/null +++ b/0015-Revert-cgroup-cpuset-Prevent-UAF-in-proc_cpuset_show.patch @@ -0,0 +1,53 @@ +From 38236cff866b4ec6021318815cd2da4194d6fe35 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:47:09 +0800 +Subject: [PATCH 15/23] Revert "cgroup/cpuset: Prevent UAF in + proc_cpuset_show()" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit a91bb3a04430844abe9e89f90af3ee076f2d9387. + +Signed-off-by: ZhangPeng +--- + kernel/cgroup/cpuset.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c +index f3cf9b1268e0..140dfb5ad3fc 100644 +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -21,7 +21,6 @@ + * License. See the file COPYING in the main directory of the Linux + * distribution for more details. + */ +-#include "cgroup-internal.h" + + #include + #include +@@ -5192,14 +5191,10 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, + if (!buf) + goto out; + +- rcu_read_lock(); +- spin_lock_irq(&css_set_lock); +- css = task_css(tsk, cpuset_cgrp_id); +- retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX, +- current->nsproxy->cgroup_ns); +- spin_unlock_irq(&css_set_lock); +- rcu_read_unlock(); +- ++ css = task_get_css(tsk, cpuset_cgrp_id); ++ retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX, ++ current->nsproxy->cgroup_ns); ++ css_put(css); + if (retval >= PATH_MAX) + retval = -ENAMETOOLONG; + if (retval < 0) +-- +2.25.1 + diff --git a/0016-Revert-cgroup-Move-rcu_head-up-near-the-top-of-cgrou.patch b/0016-Revert-cgroup-Move-rcu_head-up-near-the-top-of-cgrou.patch new file mode 100644 index 0000000..2e9b459 --- /dev/null +++ b/0016-Revert-cgroup-Move-rcu_head-up-near-the-top-of-cgrou.patch @@ -0,0 +1,48 @@ +From 5833acf1bc268d4b1417cea9fb549232d3173b63 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:47:29 +0800 +Subject: [PATCH 16/23] Revert "cgroup: Move rcu_head up near the top of + cgroup_root" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit ca7d6bd47172e001b6641e6bfe4e66a530433fe0. + +Signed-off-by: ZhangPeng +--- + include/linux/cgroup-defs.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h +index 8eb518ce87a1..05ece896af7d 100644 +--- a/include/linux/cgroup-defs.h ++++ b/include/linux/cgroup-defs.h +@@ -573,10 +573,6 @@ struct cgroup_root { + /* Unique id for this hierarchy. */ + int hierarchy_id; + +- /* A list running through the active hierarchies */ +- struct list_head root_list; +- struct rcu_head rcu; /* Must be near the top */ +- + /* + * The root cgroup. The containing cgroup_root will be destroyed on its + * release. cgrp->ancestors[0] will be used overflowing into the +@@ -593,6 +589,10 @@ struct cgroup_root { + /* Wait while cgroups are being destroyed */ + wait_queue_head_t wait; + ++ /* A list running through the active hierarchies */ ++ struct list_head root_list; ++ struct rcu_head rcu; ++ + /* Hierarchy-specific flags */ + unsigned int flags; + +-- +2.25.1 + diff --git a/0017-Revert-cgroup-Make-operations-on-the-cgroup-root_lis.patch b/0017-Revert-cgroup-Make-operations-on-the-cgroup-root_lis.patch new file mode 100644 index 0000000..6aaf129 --- /dev/null +++ b/0017-Revert-cgroup-Make-operations-on-the-cgroup-root_lis.patch @@ -0,0 +1,126 @@ +From 1d5f6069f6212c51aa56b64922e60ec4eb3c0e3a Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:47:53 +0800 +Subject: [PATCH 17/23] Revert "cgroup: Make operations on the cgroup root_list + RCU safe" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 486eff6ae48b78edc20a4e51596f332c20f2f75f. + +Signed-off-by: ZhangPeng +--- + include/linux/cgroup-defs.h | 1 - + kernel/cgroup/cgroup-internal.h | 3 +-- + kernel/cgroup/cgroup.c | 23 +++++++---------------- + 3 files changed, 8 insertions(+), 19 deletions(-) + +diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h +index 05ece896af7d..6e3227a688de 100644 +--- a/include/linux/cgroup-defs.h ++++ b/include/linux/cgroup-defs.h +@@ -591,7 +591,6 @@ struct cgroup_root { + + /* A list running through the active hierarchies */ + struct list_head root_list; +- struct rcu_head rcu; + + /* Hierarchy-specific flags */ + unsigned int flags; +diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h +index f5fb12890645..96a9bd2c26f0 100644 +--- a/kernel/cgroup/cgroup-internal.h ++++ b/kernel/cgroup/cgroup-internal.h +@@ -170,8 +170,7 @@ extern struct list_head cgroup_roots; + + /* iterate across the hierarchies */ + #define for_each_root(root) \ +- list_for_each_entry_rcu((root), &cgroup_roots, root_list, \ +- lockdep_is_held(&cgroup_mutex)) ++ list_for_each_entry((root), &cgroup_roots, root_list) + + /** + * for_each_subsys - iterate all enabled cgroup subsystems +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c +index c26a9b3a3576..52fe6ba2fefd 100644 +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -1315,7 +1315,7 @@ static void cgroup_exit_root_id(struct cgroup_root *root) + + void cgroup_free_root(struct cgroup_root *root) + { +- kfree_rcu(root, rcu); ++ kfree(root); + } + + static void cgroup_destroy_root(struct cgroup_root *root) +@@ -1348,7 +1348,7 @@ static void cgroup_destroy_root(struct cgroup_root *root) + spin_unlock_irq(&css_set_lock); + + if (!list_empty(&root->root_list)) { +- list_del_rcu(&root->root_list); ++ list_del(&root->root_list); + cgroup_root_count--; + } + +@@ -1388,15 +1388,7 @@ static inline struct cgroup *__cset_cgroup_from_root(struct css_set *cset, + } + } + +- /* +- * If cgroup_mutex is not held, the cgrp_cset_link will be freed +- * before we remove the cgroup root from the root_list. Consequently, +- * when accessing a cgroup root, the cset_link may have already been +- * freed, resulting in a NULL res_cgroup. However, by holding the +- * cgroup_mutex, we ensure that res_cgroup can't be NULL. +- * If we don't hold cgroup_mutex in the caller, we must do the NULL +- * check. +- */ ++ BUG_ON(!res_cgroup); + return res_cgroup; + } + +@@ -1455,6 +1447,7 @@ static struct cgroup *current_cgns_cgroup_dfl(void) + static struct cgroup *cset_cgroup_from_root(struct css_set *cset, + struct cgroup_root *root) + { ++ lockdep_assert_held(&cgroup_mutex); + lockdep_assert_held(&css_set_lock); + + return __cset_cgroup_from_root(cset, root); +@@ -1462,9 +1455,7 @@ static struct cgroup *cset_cgroup_from_root(struct css_set *cset, + + /* + * Return the cgroup for "task" from the given hierarchy. Must be +- * called with css_set_lock held to prevent task's groups from being modified. +- * Must be called with either cgroup_mutex or rcu read lock to prevent the +- * cgroup root from being destroyed. ++ * called with cgroup_mutex and css_set_lock held. + */ + struct cgroup *task_cgroup_from_root(struct task_struct *task, + struct cgroup_root *root) +@@ -2039,7 +2030,7 @@ void init_cgroup_root(struct cgroup_fs_context *ctx) + struct cgroup_root *root = ctx->root; + struct cgroup *cgrp = &root->cgrp; + +- INIT_LIST_HEAD_RCU(&root->root_list); ++ INIT_LIST_HEAD(&root->root_list); + atomic_set(&root->nr_cgrps, 1); + cgrp->root = root; + init_cgroup_housekeeping(cgrp); +@@ -2123,7 +2114,7 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask) + * care of subsystems' refcounts, which are explicitly dropped in + * the failure exit path. + */ +- list_add_rcu(&root->root_list, &cgroup_roots); ++ list_add(&root->root_list, &cgroup_roots); + cgroup_root_count++; + + /* +-- +2.25.1 + diff --git a/0018-Revert-Revert-cgroup-fix-uaf-when-proc_cpuset_show.patch b/0018-Revert-Revert-cgroup-fix-uaf-when-proc_cpuset_show.patch new file mode 100644 index 0000000..b8e18e6 --- /dev/null +++ b/0018-Revert-Revert-cgroup-fix-uaf-when-proc_cpuset_show.patch @@ -0,0 +1,66 @@ +From d30511d1f6f091395dd704bd78c5f2d7b04a59df Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:48:18 +0800 +Subject: [PATCH 18/23] Revert "Revert "cgroup: fix uaf when proc_cpuset_show"" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit e52b70344587721e723fc748454520328e120484. + +Signed-off-by: ZhangPeng +--- + kernel/cgroup/cpuset.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c +index 140dfb5ad3fc..2c9e50f09fc1 100644 +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -5185,6 +5185,7 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, + char *buf; + struct cgroup_subsys_state *css; + int retval; ++ struct cgroup *root_cgroup = NULL; + + retval = -ENOMEM; + buf = kmalloc(PATH_MAX, GFP_KERNEL); +@@ -5192,9 +5193,32 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns, + goto out; + + css = task_get_css(tsk, cpuset_cgrp_id); ++ rcu_read_lock(); ++ /* ++ * When the cpuset subsystem is mounted on the legacy hierarchy, ++ * the top_cpuset.css->cgroup does not hold a reference count of ++ * cgroup_root.cgroup. This makes accessing css->cgroup very ++ * dangerous because when the cpuset subsystem is remounted to the ++ * default hierarchy, the cgroup_root.cgroup that css->cgroup points ++ * to will be released, leading to a UAF issue. To avoid this problem, ++ * get the reference count of top_cpuset.css->cgroup first. ++ * ++ * This is ugly!! ++ */ ++ if (css == &top_cpuset.css) { ++ root_cgroup = css->cgroup; ++ if (!css_tryget_online(&root_cgroup->self)) { ++ rcu_read_unlock(); ++ retval = -EBUSY; ++ goto out_free; ++ } ++ } ++ rcu_read_unlock(); + retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX, + current->nsproxy->cgroup_ns); + css_put(css); ++ if (root_cgroup) ++ css_put(&root_cgroup->self); + if (retval >= PATH_MAX) + retval = -ENAMETOOLONG; + if (retval < 0) +-- +2.25.1 + diff --git a/0019-Revert-kabi-reserver-space-for-i2c.patch b/0019-Revert-kabi-reserver-space-for-i2c.patch new file mode 100644 index 0000000..bfacc66 --- /dev/null +++ b/0019-Revert-kabi-reserver-space-for-i2c.patch @@ -0,0 +1,35 @@ +From ad0d39369e6a0374c4fe1cdbc75518333d8cc24d Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:48:58 +0800 +Subject: [PATCH 19/23] Revert "kabi reserver space for i2c" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 3121af55f328c87e8053d6e1580c25d1290899ef. + +Signed-off-by: ZhangPeng +--- + include/linux/i2c.h | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/include/linux/i2c.h b/include/linux/i2c.h +index 3fd6932bf8cd..32cf5708d5a5 100644 +--- a/include/linux/i2c.h ++++ b/include/linux/i2c.h +@@ -746,9 +746,6 @@ struct i2c_adapter { + + struct irq_domain *host_notify_domain; + struct regulator *bus_regulator; +- +- KABI_RESERVE(1) +- KABI_RESERVE(2) + }; + #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) + +-- +2.25.1 + diff --git a/0020-Revert-kabi-reserve-space-for-uprobes.h.patch b/0020-Revert-kabi-reserve-space-for-uprobes.h.patch new file mode 100644 index 0000000..96462b2 --- /dev/null +++ b/0020-Revert-kabi-reserve-space-for-uprobes.h.patch @@ -0,0 +1,48 @@ +From 1cd1d17b496958d526ba139166d0e0251e2bd224 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:49:30 +0800 +Subject: [PATCH 20/23] Revert "kabi: reserve space for uprobes.h" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 59a2a3e8b1c35d9e0bde08cd2e6f01f1c12d384b. + +Signed-off-by: ZhangPeng +--- + include/linux/uprobes.h | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h +index 86d0868b584a..f46e0ca0169c 100644 +--- a/include/linux/uprobes.h ++++ b/include/linux/uprobes.h +@@ -47,7 +47,6 @@ struct uprobe_consumer { + + #ifdef CONFIG_UPROBES + #include +-#include + + enum uprobe_task_state { + UTASK_RUNNING, +@@ -79,14 +78,6 @@ struct uprobe_task { + + struct return_instance *return_instances; + unsigned int depth; +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) +- KABI_RESERVE(5) +- KABI_RESERVE(6) +- KABI_RESERVE(7) +- KABI_RESERVE(8) + }; + + struct return_instance { +-- +2.25.1 + diff --git a/0021-Revert-kabi-reserve-space-for-internal.h.patch b/0021-Revert-kabi-reserve-space-for-internal.h.patch new file mode 100644 index 0000000..f40b0d8 --- /dev/null +++ b/0021-Revert-kabi-reserve-space-for-internal.h.patch @@ -0,0 +1,49 @@ +From 1863036b346af2c6da66ab06bdf86b83b1424dce Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:49:51 +0800 +Subject: [PATCH 21/23] Revert "kabi: reserve space for internal.h" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 078ad81846b81844eb98f90eee57c06954715c8d. + +Signed-off-by: ZhangPeng +--- + kernel/events/internal.h | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/kernel/events/internal.h b/kernel/events/internal.h +index d1ffa00b91b6..d2e6e6144c54 100644 +--- a/kernel/events/internal.h ++++ b/kernel/events/internal.h +@@ -5,7 +5,6 @@ + #include + #include + #include +-#include + + /* Buffer handling */ + +@@ -55,15 +54,6 @@ struct perf_buffer { + void **aux_pages; + void *aux_priv; + +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) +- KABI_RESERVE(5) +- KABI_RESERVE(6) +- KABI_RESERVE(7) +- KABI_RESERVE(8) +- + struct perf_event_mmap_page *user_page; + void *data_pages[]; + }; +-- +2.25.1 + diff --git a/0022-Revert-kabi-reserve-space-for-perf_event.h.patch b/0022-Revert-kabi-reserve-space-for-perf_event.h.patch new file mode 100644 index 0000000..2bfeee1 --- /dev/null +++ b/0022-Revert-kabi-reserve-space-for-perf_event.h.patch @@ -0,0 +1,55 @@ +From c91689cce7fd2e2e35d7436268a766ebf21abf90 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:50:16 +0800 +Subject: [PATCH 22/23] Revert "kabi: reserve space for perf_event.h" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 279803fa98908bd367cec04ae2600c15764fb977. + +Signed-off-by: ZhangPeng +--- + include/linux/perf_event.h | 16 ---------------- + 1 file changed, 16 deletions(-) + +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h +index fe692e9bd0b2..89f2a02db563 100644 +--- a/include/linux/perf_event.h ++++ b/include/linux/perf_event.h +@@ -1010,14 +1010,6 @@ struct perf_cpu_pmu_context { + struct hrtimer hrtimer; + ktime_t hrtimer_interval; + unsigned int hrtimer_active; +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) +- KABI_RESERVE(5) +- KABI_RESERVE(6) +- KABI_RESERVE(7) +- KABI_RESERVE(8) + }; + + /** +@@ -1039,14 +1031,6 @@ struct perf_cpu_context { + int heap_size; + struct perf_event **heap; + struct perf_event *heap_default[2]; +- KABI_RESERVE(1) +- KABI_RESERVE(2) +- KABI_RESERVE(3) +- KABI_RESERVE(4) +- KABI_RESERVE(5) +- KABI_RESERVE(6) +- KABI_RESERVE(7) +- KABI_RESERVE(8) + }; + + struct perf_output_handle { +-- +2.25.1 + diff --git a/0023-Revert-bpf-Add-kabi-reserve-padding-for-uapi-struct-.patch b/0023-Revert-bpf-Add-kabi-reserve-padding-for-uapi-struct-.patch new file mode 100644 index 0000000..d04a902 --- /dev/null +++ b/0023-Revert-bpf-Add-kabi-reserve-padding-for-uapi-struct-.patch @@ -0,0 +1,63 @@ +From 3f3e3cdb66ece50873bd8de6a33d693bad241179 Mon Sep 17 00:00:00 2001 +From: ZhangPeng +Date: Tue, 24 Dec 2024 16:51:09 +0800 +Subject: [PATCH 23/23] Revert "bpf: Add kabi reserve padding for uapi struct + bpf_link_info" + +hulk inclusion +category: feature +bugzilla: https://gitee.com/openeuler/kernel/issues/IBDFAV + +---------------------------------------------------------------------- + +This reverts commit 51914230fbc72797f3cf7d5b0d9e90b00c995193. + +Signed-off-by: ZhangPeng +--- + include/uapi/linux/bpf.h | 9 --------- + tools/include/uapi/linux/bpf.h | 9 --------- + 2 files changed, 18 deletions(-) + +diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h +index a660cb68c853..482647774bf5 100644 +--- a/include/uapi/linux/bpf.h ++++ b/include/uapi/linux/bpf.h +@@ -6573,15 +6573,6 @@ struct bpf_link_info { + __u64 config; + __u32 type; + } event; /* BPF_PERF_EVENT_EVENT */ +- struct { +- __u64:64; +- __u32:32; +- __u32:32; +- __u64:64; +- __u64:64; +- __u64:64; +- __u64:64; +- } kabi_reserve; + }; + } perf_event; + struct { +diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h +index 9b302242be6c..c112c6f7c766 100644 +--- a/tools/include/uapi/linux/bpf.h ++++ b/tools/include/uapi/linux/bpf.h +@@ -6576,15 +6576,6 @@ struct bpf_link_info { + __u64 config; + __u32 type; + } event; /* BPF_PERF_EVENT_EVENT */ +- struct { +- __u64:64; +- __u32:32; +- __u32:32; +- __u64:64; +- __u64:64; +- __u64:64; +- __u64:64; +- } kabi_reserve; + }; + } perf_event; + struct { +-- +2.25.1 + diff --git a/kernel.spec b/kernel.spec index 59d8521..2046a8f 100644 --- a/kernel.spec +++ b/kernel.spec @@ -42,7 +42,7 @@ rm -f test_openEuler_sign.ko test_openEuler_sign.ko.sig %global upstream_sublevel 0 %global devel_release 72 %global maintenance_release .0.0 -%global pkg_release .63 +%global pkg_release .64 %global openeuler_lts 1 %global openeuler_major 2403 @@ -125,6 +125,25 @@ Patch0001: 0001-riscv-kernel.patch Patch0002: 0002-cpupower-clang-compile-support.patch Patch0003: 0003-x86_energy_perf_policy-clang-compile-support.patch Patch0004: 0004-turbostat-clang-compile-support.patch +Patch0005: 0005-Revert-seq_file-kabi-KABI-reservation-for-seq_file.patch +Patch0006: 0006-Revert-statx-kabi-KABI-reservation-for-kstat.patch +Patch0007: 0007-Revert-net-kabi-Reserve-space-for-net-structures.patch +Patch0008: 0008-Revert-kabi-net-reserve-space-for-xdp-subsystem-rela.patch +Patch0009: 0009-Revert-iommu-Reserve-extra-KABI-entry-for-struct-iop.patch +Patch0010: 0010-Revert-x86-config-Enable-CONFIG_CMA-by-default-in-op.patch +Patch0011: 0011-Revert-x86-Kconfig-Select-CONFIG_CMA-if-CONFIG_HYGON.patch +Patch0012: 0012-Revert-include-msi-modify-kabi-size-of-msi_desc.patch +Patch0013: 0013-Revert-fs-Allow-fine-grained-control-of-folio-sizes.patch +Patch0014: 0014-Revert-cgroup-add-more-reserve-kabi.patch +Patch0015: 0015-Revert-cgroup-cpuset-Prevent-UAF-in-proc_cpuset_show.patch +Patch0016: 0016-Revert-cgroup-Move-rcu_head-up-near-the-top-of-cgrou.patch +Patch0017: 0017-Revert-cgroup-Make-operations-on-the-cgroup-root_lis.patch +Patch0018: 0018-Revert-Revert-cgroup-fix-uaf-when-proc_cpuset_show.patch +Patch0019: 0019-Revert-kabi-reserver-space-for-i2c.patch +Patch0020: 0020-Revert-kabi-reserve-space-for-uprobes.h.patch +Patch0021: 0021-Revert-kabi-reserve-space-for-internal.h.patch +Patch0022: 0022-Revert-kabi-reserve-space-for-perf_event.h.patch +Patch0023: 0023-Revert-bpf-Add-kabi-reserve-padding-for-uapi-struct-.patch #BuildRequires: BuildRequires: module-init-tools, patch >= 2.5.4, bash >= 2.03, tar @@ -366,6 +385,26 @@ Applypatches series.conf %{_builddir}/kernel-%{version}/linux-%{KernelVer} %patch0004 -p1 %endif +%patch0005 -p1 +%patch0006 -p1 +%patch0007 -p1 +%patch0008 -p1 +%patch0009 -p1 +%patch0010 -p1 +%patch0011 -p1 +%patch0012 -p1 +%patch0013 -p1 +%patch0014 -p1 +%patch0015 -p1 +%patch0016 -p1 +%patch0017 -p1 +%patch0018 -p1 +%patch0019 -p1 +%patch0020 -p1 +%patch0021 -p1 +%patch0022 -p1 +%patch0023 -p1 + find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null find . -name .gitignore -exec rm -f {} \; >/dev/null @@ -1085,6 +1124,9 @@ fi %endif %changelog +* Tue Dec 24 2024 ZhangPeng - 6.6.0-72.0.0.64 +- Revert kabi broken patches for 24.03-LTS + * Tue Dec 24 2024 ZhangPeng - 6.6.0-72.0.0.63 - !14213 v2 bpf: Add kabi reserve padding for uapi struct bpf_link_info - bpf: Add kabi reserve padding for uapi struct bpf_link_info