From: Sasha Levin Date: Fri, 11 Oct 2024 12:10:02 +0000 (-0400) Subject: Fixes for 6.11 X-Git-Tag: v5.10.227~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b33e69b3fb8ff61d0b72c7e25705b0cf31894f3;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.11 Signed-off-by: Sasha Levin --- diff --git a/queue-6.11/fs-ntfs3-do-not-call-file_modified-if-collapse-range.patch b/queue-6.11/fs-ntfs3-do-not-call-file_modified-if-collapse-range.patch new file mode 100644 index 00000000000..eb06ffbe841 --- /dev/null +++ b/queue-6.11/fs-ntfs3-do-not-call-file_modified-if-collapse-range.patch @@ -0,0 +1,41 @@ +From 85ce6e5b3963406077169e54a9f835d0e811787d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Jun 2024 18:29:46 +0300 +Subject: fs/ntfs3: Do not call file_modified if collapse range failed + +From: Konstantin Komarov + +[ Upstream commit 2db86f7995fe6b62a4d6fee9f3cdeba3c6d27606 ] + +Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/file.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c +index ca1ddc46bd866..cddc51f9a93b2 100644 +--- a/fs/ntfs3/file.c ++++ b/fs/ntfs3/file.c +@@ -484,7 +484,7 @@ static int ntfs_truncate(struct inode *inode, loff_t new_size) + } + + /* +- * ntfs_fallocate ++ * ntfs_fallocate - file_operations::ntfs_fallocate + * + * Preallocate space for a file. This implements ntfs's fallocate file + * operation, which gets called from sys_fallocate system call. User +@@ -619,6 +619,8 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len) + ni_lock(ni); + err = attr_collapse_range(ni, vbo, len); + ni_unlock(ni); ++ if (err) ++ goto out; + } else if (mode & FALLOC_FL_INSERT_RANGE) { + /* Check new size. */ + err = inode_newsize_ok(inode, new_size); +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-fix-sparse-warning-for-bigendian.patch b/queue-6.11/fs-ntfs3-fix-sparse-warning-for-bigendian.patch new file mode 100644 index 00000000000..39b6889261e --- /dev/null +++ b/queue-6.11/fs-ntfs3-fix-sparse-warning-for-bigendian.patch @@ -0,0 +1,38 @@ +From 97b6c69f8f661a5086d02b211230517a13c64e23 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Aug 2024 16:24:59 +0300 +Subject: fs/ntfs3: Fix sparse warning for bigendian + +From: Konstantin Komarov + +[ Upstream commit ffe718c9924eb7e4ce062dd383cf5fea7f02f180 ] + +Fixes: 220cf0498bbf ("fs/ntfs3: Simplify initialization of $AttrDef and $UpCase") +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202404181111.Wz8a1qX6-lkp@intel.com/ +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/super.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c +index a8758b85803f4..28fed4072f67c 100644 +--- a/fs/ntfs3/super.c ++++ b/fs/ntfs3/super.c +@@ -1491,11 +1491,10 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) + + #ifdef __BIG_ENDIAN + { +- const __le16 *src = sbi->upcase; + u16 *dst = sbi->upcase; + + for (i = 0; i < 0x10000; i++) +- *dst++ = le16_to_cpu(*src++); ++ __swab16s(dst++); + } + #endif + +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-fix-sparse-warning-in-ni_fiemap.patch b/queue-6.11/fs-ntfs3-fix-sparse-warning-in-ni_fiemap.patch new file mode 100644 index 00000000000..1765ee75d5b --- /dev/null +++ b/queue-6.11/fs-ntfs3-fix-sparse-warning-in-ni_fiemap.patch @@ -0,0 +1,108 @@ +From 011bf497e3570543793986d7a5d5390e82bc468f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Aug 2024 16:23:02 +0300 +Subject: fs/ntfs3: Fix sparse warning in ni_fiemap + +From: Konstantin Komarov + +[ Upstream commit 62fea783f96ce825f0ac9e40ce9530ddc1ea2a29 ] + +The interface of fiemap_fill_next_extent_k() was modified +to eliminate the sparse warning. + +Fixes: d57431c6f511 ("fs/ntfs3: Do copy_to_user out of run_lock") +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202406271920.hndE8N6D-lkp@intel.com/ +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/frecord.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c +index a469c608a3948..60c975ac38e61 100644 +--- a/fs/ntfs3/frecord.c ++++ b/fs/ntfs3/frecord.c +@@ -1900,13 +1900,13 @@ enum REPARSE_SIGN ni_parse_reparse(struct ntfs_inode *ni, struct ATTRIB *attr, + + /* + * fiemap_fill_next_extent_k - a copy of fiemap_fill_next_extent +- * but it accepts kernel address for fi_extents_start ++ * but it uses 'fe_k' instead of fieinfo->fi_extents_start + */ + static int fiemap_fill_next_extent_k(struct fiemap_extent_info *fieinfo, +- u64 logical, u64 phys, u64 len, u32 flags) ++ struct fiemap_extent *fe_k, u64 logical, ++ u64 phys, u64 len, u32 flags) + { + struct fiemap_extent extent; +- struct fiemap_extent __user *dest = fieinfo->fi_extents_start; + + /* only count the extents */ + if (fieinfo->fi_extents_max == 0) { +@@ -1930,8 +1930,7 @@ static int fiemap_fill_next_extent_k(struct fiemap_extent_info *fieinfo, + extent.fe_length = len; + extent.fe_flags = flags; + +- dest += fieinfo->fi_extents_mapped; +- memcpy(dest, &extent, sizeof(extent)); ++ memcpy(fe_k + fieinfo->fi_extents_mapped, &extent, sizeof(extent)); + + fieinfo->fi_extents_mapped++; + if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max) +@@ -1949,7 +1948,6 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + __u64 vbo, __u64 len) + { + int err = 0; +- struct fiemap_extent __user *fe_u = fieinfo->fi_extents_start; + struct fiemap_extent *fe_k = NULL; + struct ntfs_sb_info *sbi = ni->mi.sbi; + u8 cluster_bits = sbi->cluster_bits; +@@ -2008,7 +2006,6 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + err = -ENOMEM; + goto out; + } +- fieinfo->fi_extents_start = fe_k; + + end = vbo + len; + alloc_size = le64_to_cpu(attr->nres.alloc_size); +@@ -2098,8 +2095,8 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + if (vbo + dlen >= end) + flags |= FIEMAP_EXTENT_LAST; + +- err = fiemap_fill_next_extent_k(fieinfo, vbo, lbo, dlen, +- flags); ++ err = fiemap_fill_next_extent_k(fieinfo, fe_k, vbo, lbo, ++ dlen, flags); + + if (err < 0) + break; +@@ -2120,7 +2117,7 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + if (vbo + bytes >= end) + flags |= FIEMAP_EXTENT_LAST; + +- err = fiemap_fill_next_extent_k(fieinfo, vbo, lbo, bytes, ++ err = fiemap_fill_next_extent_k(fieinfo, fe_k, vbo, lbo, bytes, + flags); + if (err < 0) + break; +@@ -2137,15 +2134,13 @@ int ni_fiemap(struct ntfs_inode *ni, struct fiemap_extent_info *fieinfo, + /* + * Copy to user memory out of lock + */ +- if (copy_to_user(fe_u, fe_k, ++ if (copy_to_user(fieinfo->fi_extents_start, fe_k, + fieinfo->fi_extents_max * + sizeof(struct fiemap_extent))) { + err = -EFAULT; + } + + out: +- /* Restore original pointer. */ +- fieinfo->fi_extents_start = fe_u; + kfree(fe_k); + return err; + } +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-optimize-large-writes-into-sparse-file.patch b/queue-6.11/fs-ntfs3-optimize-large-writes-into-sparse-file.patch new file mode 100644 index 00000000000..edcb4bb9ac3 --- /dev/null +++ b/queue-6.11/fs-ntfs3-optimize-large-writes-into-sparse-file.patch @@ -0,0 +1,71 @@ +From fa273f671b4908e84d3a8ed6c75a805e3047282f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Jun 2024 18:27:46 +0300 +Subject: fs/ntfs3: Optimize large writes into sparse file + +From: Konstantin Komarov + +[ Upstream commit acdbd67bf939577d6f9e3cf796a005c31cec52d8 ] + +Optimized cluster allocation by allocating a large chunk in advance +before writing, instead of allocating during the writing process +by clusters. +Essentially replicates the logic of fallocate. + +Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation") +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/file.c | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c +index cddc51f9a93b2..d31eae611fe06 100644 +--- a/fs/ntfs3/file.c ++++ b/fs/ntfs3/file.c +@@ -408,6 +408,42 @@ static int ntfs_extend(struct inode *inode, loff_t pos, size_t count, + err = 0; + } + ++ if (file && is_sparsed(ni)) { ++ /* ++ * This code optimizes large writes to sparse file. ++ * TODO: merge this fragment with fallocate fragment. ++ */ ++ struct ntfs_sb_info *sbi = ni->mi.sbi; ++ CLST vcn = pos >> sbi->cluster_bits; ++ CLST cend = bytes_to_cluster(sbi, end); ++ CLST cend_v = bytes_to_cluster(sbi, ni->i_valid); ++ CLST lcn, clen; ++ bool new; ++ ++ if (cend_v > cend) ++ cend_v = cend; ++ ++ /* ++ * Allocate and zero new clusters. ++ * Zeroing these clusters may be too long. ++ */ ++ for (; vcn < cend_v; vcn += clen) { ++ err = attr_data_get_block(ni, vcn, cend_v - vcn, &lcn, ++ &clen, &new, true); ++ if (err) ++ goto out; ++ } ++ /* ++ * Allocate but not zero new clusters. ++ */ ++ for (; vcn < cend; vcn += clen) { ++ err = attr_data_get_block(ni, vcn, cend - vcn, &lcn, ++ &clen, &new, false); ++ if (err) ++ goto out; ++ } ++ } ++ + inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); + mark_inode_dirty(inode); + +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-refactor-enum_rstbl-to-suppress-static-chec.patch b/queue-6.11/fs-ntfs3-refactor-enum_rstbl-to-suppress-static-chec.patch new file mode 100644 index 00000000000..f3d9bb0e070 --- /dev/null +++ b/queue-6.11/fs-ntfs3-refactor-enum_rstbl-to-suppress-static-chec.patch @@ -0,0 +1,58 @@ +From 89d7c73413235daa4c7d061ec299c34b96b286ba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Jul 2024 16:51:18 +0300 +Subject: fs/ntfs3: Refactor enum_rstbl to suppress static checker + +From: Konstantin Komarov + +[ Upstream commit 56c16d5459d5c050a97a138a00a82b105a8e0a66 ] + +Comments and brief description of function enum_rstbl added. + +Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal") +Reported-by: Dan Carpenter +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/fslog.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c +index c64dd114ac652..d0d530f4e2b95 100644 +--- a/fs/ntfs3/fslog.c ++++ b/fs/ntfs3/fslog.c +@@ -609,14 +609,29 @@ static inline void add_client(struct CLIENT_REC *ca, u16 index, __le16 *head) + *head = cpu_to_le16(index); + } + ++/* ++ * Enumerate restart table. ++ * ++ * @t - table to enumerate. ++ * @c - current enumerated element. ++ * ++ * enumeration starts with @c == NULL ++ * returns next element or NULL ++ */ + static inline void *enum_rstbl(struct RESTART_TABLE *t, void *c) + { + __le32 *e; + u32 bprt; +- u16 rsize = t ? le16_to_cpu(t->size) : 0; ++ u16 rsize; ++ ++ if (!t) ++ return NULL; ++ ++ rsize = le16_to_cpu(t->size); + + if (!c) { +- if (!t || !t->total) ++ /* start enumeration. */ ++ if (!t->total) + return NULL; + e = Add2Ptr(t, sizeof(struct RESTART_TABLE)); + } else { +-- +2.43.0 + diff --git a/queue-6.11/ntfs3-change-to-non-blocking-allocation-in-ntfs_d_ha.patch b/queue-6.11/ntfs3-change-to-non-blocking-allocation-in-ntfs_d_ha.patch new file mode 100644 index 00000000000..ff01447e8ea --- /dev/null +++ b/queue-6.11/ntfs3-change-to-non-blocking-allocation-in-ntfs_d_ha.patch @@ -0,0 +1,49 @@ +From 3e07874c2ef33717efda2b40c3977332c657b6fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Sep 2024 14:19:32 -0300 +Subject: ntfs3: Change to non-blocking allocation in ntfs_d_hash + +From: Diogo Jahchan Koike + +[ Upstream commit 589996bf8c459deb5bbc9747d8f1c51658608103 ] + +d_hash is done while under "rcu-walk" and should not sleep. +__get_name() allocates using GFP_KERNEL, having the possibility +to sleep when under memory pressure. Change the allocation to +GFP_NOWAIT. + +Reported-by: syzbot+7f71f79bbfb4427b00e1@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=7f71f79bbfb4427b00e1 +Fixes: d392e85fd1e8 ("fs/ntfs3: Fix the format of the "nocase" mount option") +Signed-off-by: Diogo Jahchan Koike +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/namei.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c +index f16d318c4372a..0a70c36585463 100644 +--- a/fs/ntfs3/namei.c ++++ b/fs/ntfs3/namei.c +@@ -395,7 +395,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name) + /* + * Try slow way with current upcase table + */ +- uni = __getname(); ++ uni = kmem_cache_alloc(names_cachep, GFP_NOWAIT); + if (!uni) + return -ENOMEM; + +@@ -417,7 +417,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name) + err = 0; + + out: +- __putname(uni); ++ kmem_cache_free(names_cachep, uni); + return err; + } + +-- +2.43.0 + diff --git a/queue-6.11/perf-build-fix-build-feature-dwarf_getlocations-fail.patch b/queue-6.11/perf-build-fix-build-feature-dwarf_getlocations-fail.patch new file mode 100644 index 00000000000..d8e7bcec8b9 --- /dev/null +++ b/queue-6.11/perf-build-fix-build-feature-dwarf_getlocations-fail.patch @@ -0,0 +1,104 @@ +From 3afb4da5402e04c99c36b19fcb83de6effb4568c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Sep 2024 09:35:12 +0800 +Subject: perf build: Fix build feature-dwarf_getlocations fail for old libdw + +From: Yang Jihong + +[ Upstream commit a530337ba9ef601c93ec378fd941be43f587d563 ] + +For libdw versions below 0.177, need to link libdl.a in addition to +libbebl.a during static compilation, otherwise +feature-dwarf_getlocations compilation will fail. + +Before: + + $ make LDFLAGS=-static + BUILD: Doing 'make -j20' parallel build + + Makefile.config:483: Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157 + + + $ cat ../build/feature/test-dwarf_getlocations.make.output + /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libebl.a(eblclosebackend.o): in function `ebl_closebackend': + (.text+0x20): undefined reference to `dlclose' + collect2: error: ld returned 1 exit status + +After: + + $ make LDFLAGS=-static + + Auto-detecting system features: + ... dwarf: [ on ] + + + $ ./perf probe + Usage: perf probe [] 'PROBEDEF' ['PROBEDEF' ...] + or: perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...] + or: perf probe [] --del '[GROUP:]EVENT' ... + or: perf probe --list [GROUP:]EVENT ... + + +Fixes: 536661da6ea18fe6 ("perf: build: Only link libebl.a for old libdw") +Reviewed-by: Leo Yan +Signed-off-by: Yang Jihong +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Leo Yan +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240919013513.118527-3-yangjihong@bytedance.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/build/feature/Makefile | 3 +++ + tools/perf/Makefile.config | 5 ++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile +index a0167244b2f7f..ead476b373f69 100644 +--- a/tools/build/feature/Makefile ++++ b/tools/build/feature/Makefile +@@ -181,6 +181,9 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) + ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0) + DWARFLIBS += -lebl + endif ++ ++ # Must put -ldl after -lebl for dependency ++ DWARFLIBS += -ldl + endif + + $(OUTPUT)test-dwarf.bin: +diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config +index b452794c763ad..9fccdff682af7 100644 +--- a/tools/perf/Makefile.config ++++ b/tools/perf/Makefile.config +@@ -152,7 +152,7 @@ ifdef LIBDW_DIR + endif + DWARFLIBS := -ldw + ifeq ($(findstring -static,${LDFLAGS}),-static) +- DWARFLIBS += -lelf -ldl -lz -llzma -lbz2 -lzstd ++ DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd + + LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0 + LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION))) +@@ -163,6 +163,9 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) + ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0) + DWARFLIBS += -lebl + endif ++ ++ # Must put -ldl after -lebl for dependency ++ DWARFLIBS += -ldl + endif + FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) + FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS) +-- +2.43.0 + diff --git a/queue-6.11/perf-build-fix-static-compilation-error-when-libdw-i.patch b/queue-6.11/perf-build-fix-static-compilation-error-when-libdw-i.patch new file mode 100644 index 00000000000..00ff81ed68c --- /dev/null +++ b/queue-6.11/perf-build-fix-static-compilation-error-when-libdw-i.patch @@ -0,0 +1,137 @@ +From f8d0bb530a2b320b8afb8d558931f212e76aa036 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Sep 2024 09:35:11 +0800 +Subject: perf build: Fix static compilation error when libdw is not installed + +From: Yang Jihong + +[ Upstream commit 43f6564f18bf5b27e1675ef6f4baf68e786396b2 ] + +If libdw is not installed in build environment, the output of +'pkg-config --modversion libdw' is empty, causing LIBDW_VERSION_2 to be +empty and the shell test will have the following error: + + /bin/sh: 1: test: -lt: unexpected operator + +Before: + + $ pkg-config --modversion libdw + Package libdw was not found in the pkg-config search path. + Perhaps you should add the directory containing `libdw.pc' + to the PKG_CONFIG_PATH environment variable + No package 'libdw' found + $ make LDFLAGS=-static -j16 + BUILD: Doing 'make -j20' parallel build + + Package libdw was not found in the pkg-config search path. + Perhaps you should add the directory containing `libdw.pc' + to the PKG_CONFIG_PATH environment variable + No package 'libdw' found + /bin/sh: 1: test: -lt: unexpected operator + +After: + + 1. libdw is not installed: + + $ pkg-config --modversion libdw + Package libdw was not found in the pkg-config search path. + Perhaps you should add the directory containing `libdw.pc' + to the PKG_CONFIG_PATH environment variable + No package 'libdw' found + $ make LDFLAGS=-static -j16 + BUILD: Doing 'make -j20' parallel build + + Package libdw was not found in the pkg-config search path. + Perhaps you should add the directory containing `libdw.pc' + to the PKG_CONFIG_PATH environment variable + No package 'libdw' found + Makefile.config:473: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR + + 2. libdw version is lower than 0.177 + + $ pkg-config --modversion libdw + 0.176 + $ make LDFLAGS=-static -j16 + BUILD: Doing 'make -j20' parallel build + + + Auto-detecting system features: + ... dwarf: [ on ] + + INSTALL libsubcmd_headers + INSTALL libapi_headers + INSTALL libperf_headers + INSTALL libsymbol_headers + INSTALL libbpf_headers + LINK perf + + 3. libdw version is higher than 0.177 + + $ pkg-config --modversion libdw + 0.186 + $ make LDFLAGS=-static -j16 + BUILD: Doing 'make -j20' parallel build + + + Auto-detecting system features: + ... dwarf: [ on ] + + CC util/bpf-utils.o + CC util/pfm.o + LD util/perf-util-in.o + LD perf-util-in.o + AR libperf-util.a + LINK perf + +Fixes: 536661da6ea18fe6 ("perf: build: Only link libebl.a for old libdw") +Reviewed-by: Leo Yan +Signed-off-by: Yang Jihong +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Leo Yan +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240919013513.118527-2-yangjihong@bytedance.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/build/feature/Makefile | 2 +- + tools/perf/Makefile.config | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile +index 12796808f07a8..a0167244b2f7f 100644 +--- a/tools/build/feature/Makefile ++++ b/tools/build/feature/Makefile +@@ -172,7 +172,7 @@ DWARFLIBS := -ldw + ifeq ($(findstring -static,${LDFLAGS}),-static) + DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd + +- LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw) ++ LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0 + LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION))) + LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION))) + +diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config +index fa679db61f622..b452794c763ad 100644 +--- a/tools/perf/Makefile.config ++++ b/tools/perf/Makefile.config +@@ -154,7 +154,7 @@ DWARFLIBS := -ldw + ifeq ($(findstring -static,${LDFLAGS}),-static) + DWARFLIBS += -lelf -ldl -lz -llzma -lbz2 -lzstd + +- LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw) ++ LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0 + LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION))) + LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION))) + +-- +2.43.0 + diff --git a/queue-6.11/perf-vdso-missed-put-on-32-bit-dsos.patch b/queue-6.11/perf-vdso-missed-put-on-32-bit-dsos.patch new file mode 100644 index 00000000000..d5a8af592a5 --- /dev/null +++ b/queue-6.11/perf-vdso-missed-put-on-32-bit-dsos.patch @@ -0,0 +1,49 @@ +From eaad825bbfd3de5ecd2f6dd4feb252b6b713eede Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Sep 2024 11:27:57 -0700 +Subject: perf vdso: Missed put on 32-bit dsos + +From: Ian Rogers + +[ Upstream commit 424aafb61a0b98d7d242f447fdb84bb8b323e8a8 ] + +If the dso type doesn't match then NULL is returned but the dso should +be put first. + +Fixes: f649ed80f3cabbf1 ("perf dsos: Tidy reference counting and locking") +Signed-off-by: Ian Rogers +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20240912182757.762369-1-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/vdso.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c +index 1b6f8f6db7aa4..c12f5d8c4bf69 100644 +--- a/tools/perf/util/vdso.c ++++ b/tools/perf/util/vdso.c +@@ -308,8 +308,10 @@ static struct dso *machine__find_vdso(struct machine *machine, + if (!dso) { + dso = dsos__find(&machine->dsos, DSO__NAME_VDSO, + true); +- if (dso && dso_type != dso__type(dso, machine)) ++ if (dso && dso_type != dso__type(dso, machine)) { ++ dso__put(dso); + dso = NULL; ++ } + } + break; + case DSO__TYPE_X32BIT: +-- +2.43.0 + diff --git a/queue-6.11/series b/queue-6.11/series index 865236b891d..8f94873e3ce 100644 --- a/queue-6.11/series +++ b/queue-6.11/series @@ -1,2 +1,15 @@ unicode-don-t-special-case-ignorable-code-points.patch net-fec-don-t-save-ptp-state-if-ptp-is-unsupported.patch +fs-ntfs3-do-not-call-file_modified-if-collapse-range.patch +fs-ntfs3-optimize-large-writes-into-sparse-file.patch +fs-ntfs3-fix-sparse-warning-for-bigendian.patch +fs-ntfs3-fix-sparse-warning-in-ni_fiemap.patch +fs-ntfs3-refactor-enum_rstbl-to-suppress-static-chec.patch +vdpa-octeon_ep-fix-format-specifier-for-pointers-in-.patch +virtio_console-fix-misc-probe-bugs.patch +perf-vdso-missed-put-on-32-bit-dsos.patch +ntfs3-change-to-non-blocking-allocation-in-ntfs_d_ha.patch +perf-build-fix-static-compilation-error-when-libdw-i.patch +perf-build-fix-build-feature-dwarf_getlocations-fail.patch +zram-free-secondary-algorithms-names.patch +zram-don-t-free-statically-defined-names.patch diff --git a/queue-6.11/vdpa-octeon_ep-fix-format-specifier-for-pointers-in-.patch b/queue-6.11/vdpa-octeon_ep-fix-format-specifier-for-pointers-in-.patch new file mode 100644 index 00000000000..2cccec8e018 --- /dev/null +++ b/queue-6.11/vdpa-octeon_ep-fix-format-specifier-for-pointers-in-.patch @@ -0,0 +1,61 @@ +From bac85fe2aaa7d206d79fdf9ac19c1780fe72c4ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Sep 2024 21:52:55 +0530 +Subject: vdpa/octeon_ep: Fix format specifier for pointers in debug messages + +From: Srujana Challa + +[ Upstream commit bc0dcbc5c2c539f37004f2cce0e6e245b2e50b6c ] + +Updates the debug messages in octep_vdpa_hw.c to use the %p format +specifier for pointers instead of casting them to u64. + +Fixes smatch warning: +octep_hw_caps_read() warn: argument 3 to %016llx specifier is cast +from pointer + +Fixes: 8b6c724cdab8 ("virtio: vdpa: vDPA driver for Marvell OCTEON DPU devices") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Closes: https://lore.kernel.org/r/202409160431.bRhZWhiU-lkp@intel.com/ +Signed-off-by: Srujana Challa +Message-Id: <20240916162255.677774-1-schalla@marvell.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/vdpa/octeon_ep/octep_vdpa_hw.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/vdpa/octeon_ep/octep_vdpa_hw.c b/drivers/vdpa/octeon_ep/octep_vdpa_hw.c +index 11bd76ae18cf9..1d4767b33315e 100644 +--- a/drivers/vdpa/octeon_ep/octep_vdpa_hw.c ++++ b/drivers/vdpa/octeon_ep/octep_vdpa_hw.c +@@ -475,11 +475,11 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev) + dev_err(dev, "Incomplete PCI capabilities"); + return -EIO; + } +- dev_info(dev, "common cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->common_cfg); +- dev_info(dev, "device cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->dev_cfg); +- dev_info(dev, "isr cfg mapped at: 0x%016llx\n", (u64)(uintptr_t)oct_hw->isr); +- dev_info(dev, "notify base: 0x%016llx, notify off multiplier: %u\n", +- (u64)(uintptr_t)oct_hw->notify_base, oct_hw->notify_off_multiplier); ++ dev_info(dev, "common cfg mapped at: %p\n", oct_hw->common_cfg); ++ dev_info(dev, "device cfg mapped at: %p\n", oct_hw->dev_cfg); ++ dev_info(dev, "isr cfg mapped at: %p\n", oct_hw->isr); ++ dev_info(dev, "notify base: %p, notify off multiplier: %u\n", ++ oct_hw->notify_base, oct_hw->notify_off_multiplier); + + oct_hw->config_size = octep_get_config_size(oct_hw); + oct_hw->features = octep_hw_get_dev_features(oct_hw); +@@ -511,7 +511,7 @@ int octep_hw_caps_read(struct octep_hw *oct_hw, struct pci_dev *pdev) + } + mbox = octep_get_mbox(oct_hw); + octep_mbox_init(mbox); +- dev_info(dev, "mbox mapped at: 0x%016llx\n", (u64)(uintptr_t)mbox); ++ dev_info(dev, "mbox mapped at: %p\n", mbox); + + return 0; + } +-- +2.43.0 + diff --git a/queue-6.11/virtio_console-fix-misc-probe-bugs.patch b/queue-6.11/virtio_console-fix-misc-probe-bugs.patch new file mode 100644 index 00000000000..6c40ba40c6a --- /dev/null +++ b/queue-6.11/virtio_console-fix-misc-probe-bugs.patch @@ -0,0 +1,71 @@ +From 7e9d66382236428740af7568c56369b79c2de1a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Sep 2024 14:16:44 -0400 +Subject: virtio_console: fix misc probe bugs + +From: Michael S. Tsirkin + +[ Upstream commit b9efbe2b8f0177fa97bfab290d60858900aa196b ] + +This fixes the following issue discovered by code review: + +after vqs have been created, a buggy device can send an interrupt. + +A control vq callback will then try to schedule control_work which has +not been initialized yet. Similarly for config interrupt. Further, in +and out vq callbacks invoke find_port_by_vq which attempts to take +ports_lock which also has not been initialized. + +To fix, init all locks and work before creating vqs. + +Message-ID: +Fixes: 17634ba25544 ("virtio: console: Add a new MULTIPORT feature, support for generic ports") +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/char/virtio_console.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c +index de7d720d99fa9..bcb05fc44c998 100644 +--- a/drivers/char/virtio_console.c ++++ b/drivers/char/virtio_console.c +@@ -2007,25 +2007,27 @@ static int virtcons_probe(struct virtio_device *vdev) + multiport = true; + } + +- err = init_vqs(portdev); +- if (err < 0) { +- dev_err(&vdev->dev, "Error %d initializing vqs\n", err); +- goto free_chrdev; +- } +- + spin_lock_init(&portdev->ports_lock); + INIT_LIST_HEAD(&portdev->ports); + INIT_LIST_HEAD(&portdev->list); + +- virtio_device_ready(portdev->vdev); +- + INIT_WORK(&portdev->config_work, &config_work_handler); + INIT_WORK(&portdev->control_work, &control_work_handler); + + if (multiport) { + spin_lock_init(&portdev->c_ivq_lock); + spin_lock_init(&portdev->c_ovq_lock); ++ } + ++ err = init_vqs(portdev); ++ if (err < 0) { ++ dev_err(&vdev->dev, "Error %d initializing vqs\n", err); ++ goto free_chrdev; ++ } ++ ++ virtio_device_ready(portdev->vdev); ++ ++ if (multiport) { + err = fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); + if (err < 0) { + dev_err(&vdev->dev, +-- +2.43.0 + diff --git a/queue-6.11/zram-don-t-free-statically-defined-names.patch b/queue-6.11/zram-don-t-free-statically-defined-names.patch new file mode 100644 index 00000000000..fab6447f982 --- /dev/null +++ b/queue-6.11/zram-don-t-free-statically-defined-names.patch @@ -0,0 +1,75 @@ +From 8b48f2865a526dc801a2aac7b5c861c05ab9138b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Oct 2024 13:46:39 +0900 +Subject: zram: don't free statically defined names + +From: Andrey Skvortsov + +[ Upstream commit 486fd58af7ac1098b68370b1d4d9f94a2a1c7124 ] + +When CONFIG_ZRAM_MULTI_COMP isn't set ZRAM_SECONDARY_COMP can hold +default_compressor, because it's the same offset as ZRAM_PRIMARY_COMP, so +we need to make sure that we don't attempt to kfree() the statically +defined compressor name. + +This is detected by KASAN. + +================================================================== + Call trace: + kfree+0x60/0x3a0 + zram_destroy_comps+0x98/0x198 [zram] + zram_reset_device+0x22c/0x4a8 [zram] + reset_store+0x1bc/0x2d8 [zram] + dev_attr_store+0x44/0x80 + sysfs_kf_write+0xfc/0x188 + kernfs_fop_write_iter+0x28c/0x428 + vfs_write+0x4dc/0x9b8 + ksys_write+0x100/0x1f8 + __arm64_sys_write+0x74/0xb8 + invoke_syscall+0xd8/0x260 + el0_svc_common.constprop.0+0xb4/0x240 + do_el0_svc+0x48/0x68 + el0_svc+0x40/0xc8 + el0t_64_sync_handler+0x120/0x130 + el0t_64_sync+0x190/0x198 +================================================================== + +Link: https://lkml.kernel.org/r/20240923164843.1117010-1-andrej.skvortzov@gmail.com +Fixes: 684826f8271a ("zram: free secondary algorithms names") +Signed-off-by: Andrey Skvortsov +Reviewed-by: Sergey Senozhatsky +Reported-by: Venkat Rao Bagalkote +Closes: https://lore.kernel.org/lkml/57130e48-dbb6-4047-a8c7-ebf5aaea93f4@linux.vnet.ibm.com/ +Tested-by: Venkat Rao Bagalkote +Cc: Christophe JAILLET +Cc: Jens Axboe +Cc: Minchan Kim +Cc: Sergey Senozhatsky +Cc: Venkat Rao Bagalkote +Cc: Chris Li +Signed-off-by: Andrew Morton +Signed-off-by: Sasha Levin +--- + drivers/block/zram/zram_drv.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c +index 1a875ac43d566..f25b1670e91ca 100644 +--- a/drivers/block/zram/zram_drv.c ++++ b/drivers/block/zram/zram_drv.c +@@ -1990,8 +1990,10 @@ static void zram_destroy_comps(struct zram *zram) + zram->num_active_comps--; + } + +- for (prio = ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++) { +- kfree(zram->comp_algs[prio]); ++ for (prio = ZRAM_PRIMARY_COMP; prio < ZRAM_MAX_COMPS; prio++) { ++ /* Do not free statically defined compression algorithms */ ++ if (zram->comp_algs[prio] != default_compressor) ++ kfree(zram->comp_algs[prio]); + zram->comp_algs[prio] = NULL; + } + } +-- +2.43.0 + diff --git a/queue-6.11/zram-free-secondary-algorithms-names.patch b/queue-6.11/zram-free-secondary-algorithms-names.patch new file mode 100644 index 00000000000..64e3ec8db78 --- /dev/null +++ b/queue-6.11/zram-free-secondary-algorithms-names.patch @@ -0,0 +1,44 @@ +From a59761764a4319e8998b41dac64c6f7ef45d28d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 9 Oct 2024 13:46:38 +0900 +Subject: zram: free secondary algorithms names + +From: Sergey Senozhatsky + +[ Upstream commit 684826f8271ad97580b138b9ffd462005e470b99 ] + +We need to kfree() secondary algorithms names when reset zram device that +had multi-streams, otherwise we leak memory. + +[senozhatsky@chromium.org: kfree(NULL) is legal] + Link: https://lkml.kernel.org/r/20240917013021.868769-1-senozhatsky@chromium.org +Link: https://lkml.kernel.org/r/20240911025600.3681789-1-senozhatsky@chromium.org +Fixes: 001d92735701 ("zram: add recompression algorithm sysfs knob") +Signed-off-by: Sergey Senozhatsky +Cc: Minchan Kim +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Sasha Levin +--- + drivers/block/zram/zram_drv.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c +index efcb8d9d274c3..1a875ac43d566 100644 +--- a/drivers/block/zram/zram_drv.c ++++ b/drivers/block/zram/zram_drv.c +@@ -1989,6 +1989,11 @@ static void zram_destroy_comps(struct zram *zram) + zcomp_destroy(comp); + zram->num_active_comps--; + } ++ ++ for (prio = ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++) { ++ kfree(zram->comp_algs[prio]); ++ zram->comp_algs[prio] = NULL; ++ } + } + + static void zram_reset_device(struct zram *zram) +-- +2.43.0 +