Package build environments like Fedora rpmbuild introduced hardening
options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
and LDFLAGS.
mptcp Makefile currently overrides CFLAGS but not LDFLAGS, which leads
to a mismatch and build failure, for example:
make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/mptcp/mptcp_sockopt] Error 1
/usr/bin/ld: /tmp/ccqyMVdb.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
Signed-off-by: Jan Stancek <jstancek(a)redhat.com>
---
tools/testing/selftests/net/mptcp/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
index 8e3fc05a5397..9706bc73809f 100644
--- a/tools/testing/selftests/net/mptcp/Makefile
+++ b/tools/testing/selftests/net/mptcp/Makefile
@@ -2,7 +2,7 @@
top_srcdir = ../../../../..
-CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
+CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
--
2.43.0
A few cleanups and optimizations for the management of the kernel
configuration.
Signed-off-by: Thomas Weißschuh <linux(a)weissschuh.net>
---
Thomas Weißschuh (5):
selftests/nolibc: drop custom EXTRACONFIG functionality
selftests/nolibc: drop call to prepare target
selftests/nolibc: drop call to mrproper target
selftests/nolibc: execute defconfig before other targets
selftests/nolibc: always keep test kernel configuration up to date
tools/testing/selftests/nolibc/Makefile | 17 +++++------------
tools/testing/selftests/nolibc/run-tests.sh | 5 +----
2 files changed, 6 insertions(+), 16 deletions(-)
---
base-commit: 60fe18237f72e3a186127658452dbb0992113cf7
change-id: 20250122-nolibc-config-d639e1612c93
Best regards,
--
Thomas Weißschuh <linux(a)weissschuh.net>
Hi Linus,
Please pull the following kunit next update for Linux 6.14-rc1.
- fixes struct completion warning
- introduces autorun option
- adds fallback for os.sched_getaffinity
- enables hardware acceleration when available
Note:
Stephen reported duplicate patch in kunit and driver-core:
The following commit is also in the driver-core tree as a different commit
(but the same patch):
875aec2357cd ("kunit: platform: Resolve 'struct completion' warning")
This is commit
7687c66c18c6 ("kunit: platform: Resolve 'struct completion' warning")
in the driver-core tree.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 40384c840ea1944d7c5a392e8975ed088ecf0b37:
Linux 6.13-rc1 (2024-12-01 14:28:56 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-kunit-6.14-rc1
for you to fetch changes up to 31691914c392675bdc65d1e72dd8d129a1f0014f:
kunit: Introduce autorun option (2025-01-15 09:04:06 -0700)
----------------------------------------------------------------
linux_kselftest-kunit-6.14-rc1
- fixes struct completion warning
- introduces autorun option
- adds fallback for os.sched_getaffinity
- enables hardware acceleration when available
----------------------------------------------------------------
Brian Norris (1):
kunit: platform: Resolve 'struct completion' warning
Stanislav Kinsburskii (1):
kunit: Introduce autorun option
Tamir Duberstein (2):
kunit: add fallback for os.sched_getaffinity
kunit: enable hardware acceleration when available
include/kunit/platform_device.h | 1 +
include/kunit/test.h | 4 +++-
lib/kunit/Kconfig | 12 ++++++++++++
lib/kunit/debugfs.c | 2 +-
lib/kunit/executor.c | 21 +++++++++++++++++++--
lib/kunit/test.c | 6 ++++--
tools/testing/kunit/kunit.py | 11 ++++++++++-
tools/testing/kunit/kunit_kernel.py | 3 +++
tools/testing/kunit/qemu_configs/arm64.py | 2 +-
9 files changed, 54 insertions(+), 8 deletions(-)
----------------------------------------------------------------
Hi Linus,
Please pull the following kseltest update for Linux 6.14-rc1.
- fixes, reporting improvements, and cleanup changes to several tests
- adds support for DT_GNU_HASH to selftests/vDSO
Note:
Stephen reported conflict between the following two commits and the fix is
in the linux-next:
912d6f669725 ("selftests/net: packetdrill: report benign debug flakes as xfail")
from the net-next tree and commit:
279e9403c5bd ("selftests: Warn about skipped tests in result summary")
from the kselftest tree.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 5bc55a333a2f7316b58edc7573e8e893f7acb532:
Linux 6.13-rc7 (2025-01-12 14:37:56 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-next-6.14-rc1
for you to fetch changes up to 336d02bc4c6bec5c3d933e5d470a94970f830957:
selftests/rseq: Fix handling of glibc without rseq support (2025-01-15 10:54:48 -0700)
----------------------------------------------------------------
linux_kselftest-next-6.14-rc1
- fixes, reporting improvements, and cleanup changes to several tests
- adds support for DT_GNU_HASH to selftests/vDSO
----------------------------------------------------------------
Brendan Jackman (1):
selftests/run_kselftest.sh: Fix help string for --per-test-log
Carlos Llamas (1):
selftest: media_tests: fix trivial UAF typo
Dmitry V. Levin (1):
selftests: harness: fix printing of mismatch values in __EXPECT()
Fangrui Song (1):
selftests/vDSO: support DT_GNU_HASH
Geert Uytterhoeven (1):
selftests: timers: clocksource-switch: Adapt progress to kselftest framework
Laura Nao (1):
selftests: Warn about skipped tests in result summary
Li Zhijian (2):
selftests/filesystems: Add missing gitignore file
selftests/zram: gitignore output file
Maciej Wieczor-Retman (2):
selftests/resctrl: Adjust effective L3 cache size with SNC enabled
selftests/resctrl: Discover SNC kernel support and adjust messages
Masami Hiramatsu (Google) (2):
selftests/ftrace: Fix to use remount when testing mount GID option
selftests/ftrace: Make uprobe test more robust against binary name
Mathieu Desnoyers (1):
selftests/rseq: Fix handling of glibc without rseq support
Shivam Chaudhary (3):
selftests: acct: Add ksft_exit_skip if not running as root
selftests: tmpfs: Add Test-skip if not run as root
selftests: tmpfs: Add kselftest support to tmpfs
Stefano Pigozzi (1):
selftests: kselftest: Add ksft_test_result_xpass
Vincent Donnefort (1):
selftests/ring-buffer: Add test for out-of-bound pgoff mapping
zhang jiao (2):
selftests/ipc: Remove unused variables
selftests: kselftest: Fix the wrong format specifier
tools/testing/selftests/acct/acct_syscall.c | 2 +-
.../selftests/filesystems/statmount/.gitignore | 1 +
.../ftrace/test.d/00basic/mount_options.tc | 8 +-
.../ftrace/test.d/dynevent/add_remove_uprobe.tc | 4 +-
tools/testing/selftests/ipc/msgque.c | 2 +-
tools/testing/selftests/kselftest.h | 28 ++++-
tools/testing/selftests/kselftest/ksft.py | 3 +
tools/testing/selftests/kselftest/ktap_helpers.sh | 4 +
tools/testing/selftests/kselftest_harness.h | 24 ++--
.../selftests/media_tests/regression_test.txt | 8 +-
tools/testing/selftests/resctrl/Makefile | 1 +
tools/testing/selftests/resctrl/cmt_test.c | 4 +-
tools/testing/selftests/resctrl/mba_test.c | 2 +
tools/testing/selftests/resctrl/mbm_test.c | 4 +-
tools/testing/selftests/resctrl/resctrl.h | 6 +
tools/testing/selftests/resctrl/resctrl_tests.c | 9 +-
tools/testing/selftests/resctrl/resctrlfs.c | 137 +++++++++++++++++++++
tools/testing/selftests/ring-buffer/map_test.c | 8 +-
tools/testing/selftests/rseq/rseq.c | 32 +++--
tools/testing/selftests/rseq/rseq.h | 9 +-
tools/testing/selftests/run_kselftest.sh | 2 +-
.../testing/selftests/timers/clocksource-switch.c | 6 +-
tools/testing/selftests/tmpfs/bug-link-o-tmpfile.c | 41 +++---
tools/testing/selftests/vDSO/parse_vdso.c | 110 ++++++++++++-----
tools/testing/selftests/zram/.gitignore | 2 +
25 files changed, 371 insertions(+), 86 deletions(-)
create mode 100644 tools/testing/selftests/zram/.gitignore
----------------------------------------------------------------
While taking a look at '[PATCH net] pktgen: Avoid out-of-range in
get_imix_entries' ([1]) and '[PATCH net v2] pktgen: Avoid out-of-bounds access
in get_imix_entries' ([2], [3]) and doing some tests and code review I
detected that the /proc/net/pktgen/... parsing logic does not honour the
user given buffer bounds (resulting in out-of-bounds access).
This can be observed e.g. by the following simple test (sometimes the
old/'longer' previous value is re-read from the buffer):
$ echo add_device lo@0 > /proc/net/pktgen/kpktgend_0
$ echo "min_pkt_size 12345" > /proc/net/pktgen/lo\@0 && grep min_pkt_size /proc/net/pktgen/lo\@0
Params: count 1000 min_pkt_size: 12345 max_pkt_size: 0
Result: OK: min_pkt_size=12345
$ echo -n "min_pkt_size 123" > /proc/net/pktgen/lo\@0 && grep min_pkt_size /proc/net/pktgen/lo\@0
Params: count 1000 min_pkt_size: 12345 max_pkt_size: 0
Result: OK: min_pkt_size=12345
$ echo "min_pkt_size 123" > /proc/net/pktgen/lo\@0 && grep min_pkt_size /proc/net/pktgen/lo\@0
Params: count 1000 min_pkt_size: 123 max_pkt_size: 0
Result: OK: min_pkt_size=123
So fix the out-of-bounds access (and two minor findings) and add a simple
proc_net_pktgen selftest...
Regards,
Peter
Changes v1 -> v2:
- new patch: 'net: pktgen: fix hex32_arg parsing for short reads'
- new patch: 'net: pktgen: fix 'rate 0' error handling (return -EINVAL)'
- new patch: 'net: pktgen: fix 'ratep 0' error handling (return -EINVAL)'
- net/core/pktgen.c: additional fix get_imix_entries() and get_labels()
- tools/testing/selftests/net/proc_net_pktgen.c:
- fix tyop not vs. nod (suggested by Jakub Kicinski)
- fix misaligned line (suggested by Jakub Kicinski)
- enable fomerly commented out CONFIG_XFRM dependent test (command spi),
as CONFIG_XFRM is enabled via tools/testing/selftests/net/config
CONFIG_XFRM_INTERFACE/CONFIG_XFRM_USER (suggestex by Jakub Kicinski)
- add CONFIG_NET_PKTGEN=m to tools/testing/selftests/net/config
(suggested by Jakub Kicinski)
- add modprobe pktgen to FIXTURE_SETUP() (suggested by Jakub Kicinski)
- fix some checkpatch warnings (Missing a blank line after declarations)
- shrink line length by re-naming some variables (command -> cmd,
device -> dev)
- add 'rate 0' testcase
- add 'ratep 0' testcase
[1] https://lore.kernel.org/netdev/20241006221221.3744995-1-artem.chernyshev@re…
[2] https://lore.kernel.org/netdev/20250109083039.14004-1-pchelkin@ispras.ru/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
Peter Seiderer (8):
net: pktgen: replace ENOTSUPP with EOPNOTSUPP
net: pktgen: enable 'param=value' parsing
net: pktgen: fix hex32_arg parsing for short reads
net: pktgen: fix 'rate 0' error handling (return -EINVAL)
net: pktgen: fix 'ratep 0' error handling (return -EINVAL)
net: pktgen: fix access outside of user given buffer in
pktgen_thread_write()
net: pktgen: fix access outside of user given buffer in
pktgen_if_write()
selftest: net: add proc_net_pktgen
net/core/pktgen.c | 238 ++++---
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/config | 1 +
tools/testing/selftests/net/proc_net_pktgen.c | 605 ++++++++++++++++++
4 files changed, 761 insertions(+), 84 deletions(-)
create mode 100644 tools/testing/selftests/net/proc_net_pktgen.c
--
2.48.1
While taking a look at '[PATCH net] pktgen: Avoid out-of-range in
get_imix_entries' ([1]) and '[PATCH net v2] pktgen: Avoid out-of-bounds access
in get_imix_entries' ([2], [3]) and doing some tests and code review I
detected that the /proc/net/pktgen/... parsing logic does not honour the
user given buffer bounds (resulting in out-of-bounds access).
This can be observed e.g. by the following simple test (sometimes the
old/'longer' previous value is re-read from the buffer):
$ echo add_device lo@0 > /proc/net/pktgen/kpktgend_0
$ echo "min_pkt_size 12345" > /proc/net/pktgen/lo\@0 && grep min_pkt_size /proc/net/pktgen/lo\@0
Params: count 1000 min_pkt_size: 12345 max_pkt_size: 0
Result: OK: min_pkt_size=12345
$ echo -n "min_pkt_size 123" > /proc/net/pktgen/lo\@0 && grep min_pkt_size /proc/net/pktgen/lo\@0
Params: count 1000 min_pkt_size: 12345 max_pkt_size: 0
Result: OK: min_pkt_size=12345
$ echo "min_pkt_size 123" > /proc/net/pktgen/lo\@0 && grep min_pkt_size /proc/net/pktgen/lo\@0
Params: count 1000 min_pkt_size: 123 max_pkt_size: 0
Result: OK: min_pkt_size=123
So fix the out-of-bounds access (and two minor findings) and add a simple
proc_net_pktgen selftest...
Regards,
Peter
[1] https://lore.kernel.org/netdev/20241006221221.3744995-1-artem.chernyshev@re…
[2] https://lore.kernel.org/netdev/20250109083039.14004-1-pchelkin@ispras.ru/
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
Peter Seiderer (5):
net: pktgen: replace ENOTSUPP with EOPNOTSUPP
net: pktgen: enable 'param=value' parsing
net: pktgen: fix access outside of user given buffer in
pktgen_thread_write()
net: pktgen: fix access outside of user given buffer in
pktgen_if_write()
selftest: net: add proc_net_pktgen
net/core/pktgen.c | 210 ++++---
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/proc_net_pktgen.c | 575 ++++++++++++++++++
3 files changed, 712 insertions(+), 74 deletions(-)
create mode 100644 tools/testing/selftests/net/proc_net_pktgen.c
--
2.48.0
Hi all
This patchset adds a new buddy allocator like large folio split to the total
number of resulting folios, the amount of memory needed for multi-index xarray
split, and keep more large folios after a split. It is on top of
mm-everything-2025-01-16-06-37. It is ready to be merged.
Instead of duplicating existing split_huge_page*() code, __folio_split()
is introduced as the shared backend code for both
split_huge_page_to_list_to_order() and folio_split(). __folio_split()
can support both uniform split and buddy allocator like split. All
existing split_huge_page*() users can be gradually converted to use
folio_split() if possible. In this patchset, I converted
truncate_inode_partial_folio() to use folio_split().
xfstests quick group passed for both tmpfs and xfs.
Changelog
===
From V4[6]:
1. Enabled shmem support in both uniform and buddy allocator like split
and added selftests for it.
2. Added functions to check if uniform split and buddy allocator like
split are supported for the given folio and order.
3. Made truncate fall back to uniform split if buddy allocator split is
not supported (CONFIG_READ_ONLY_THP_FOR_FS and FS without large folio).
4. Added the missing folio_clear_has_hwpoisoned() to
__split_unmapped_folio().
From V3[5]:
1. Used xas_split_alloc(GFP_NOWAIT) instead of xas_nomem(), since extra
operations inside xas_split_alloc() are needed for correctness.
2. Enabled folio_split() for shmem and no issue was found with xfstests
quick test group.
3. Split both ends of a truncate range in truncate_inode_partial_folio()
to avoid wasting memory in shmem truncate (per David Hildenbrand).
4. Removed page_in_folio_offset() since page_folio() does the same
thing.
5. Finished truncate related tests from xfstests quick test group on XFS and
tmpfs without issues.
6. Disabled buddy allocator like split on CONFIG_READ_ONLY_THP_FOR_FS
and FS without large folio. This check was missed in the prior
versions.
From V2[3]:
1. Incorporated all the feedback from Kirill[4].
2. Used GFP_NOWAIT for xas_nomem().
3. Tested the code path when xas_nomem() fails.
4. Added selftests for folio_split().
5. Fixed no THP config build error.
From V1[2]:
1. Split the original patch 1 into multiple ones for easy review (per
Kirill).
2. Added xas_destroy() to avoid memory leak.
3. Fixed nr_dropped not used error (per kernel test robot).
4. Added proper error handling when xas_nomem() fails to allocate memory
for xas_split() during buddy allocator like split.
From RFC[1]:
1. Merged backend code of split_huge_page_to_list_to_order() and
folio_split(). The same code is used for both uniform split and buddy
allocator like split.
2. Use xas_nomem() instead of xas_split_alloc() for folio_split().
3. folio_split() now leaves the first after-split folio unlocked,
instead of the one containing the given page, since
the caller of truncate_inode_partial_folio() locks and unlocks the
first folio.
4. Extended split_huge_page debugfs to use folio_split().
5. Added truncate_inode_partial_folio() as first user of folio_split().
Design
===
folio_split() splits a large folio in the same way as buddy allocator
splits a large free page for allocation. The purpose is to minimize the
number of folios after the split. For example, if user wants to free the
3rd subpage in a order-9 folio, folio_split() will split the order-9 folio
as:
O-0, O-0, O-0, O-0, O-2, O-3, O-4, O-5, O-6, O-7, O-8 if it is anon
O-1, O-0, O-0, O-2, O-3, O-4, O-5, O-6, O-7, O-9 if it is pagecache
Since anon folio does not support order-1 yet.
The split process is similar to existing approach:
1. Unmap all page mappings (split PMD mappings if exist);
2. Split meta data like memcg, page owner, page alloc tag;
3. Copy meta data in struct folio to sub pages, but instead of spliting
the whole folio into multiple smaller ones with the same order in a
shot, this approach splits the folio iteratively. Taking the example
above, this approach first splits the original order-9 into two order-8,
then splits left part of order-8 to two order-7 and so on;
4. Post-process split folios, like write mapping->i_pages for pagecache,
adjust folio refcounts, add split folios to corresponding list;
5. Remap split folios
6. Unlock split folios.
__split_unmapped_folio() and __split_folio_to_order() replace
__split_huge_page() and __split_huge_page_tail() respectively.
__split_unmapped_folio() uses different approaches to perform
uniform split and buddy allocator like split:
1. uniform split: one single call to __split_folio_to_order() is used to
uniformly split the given folio. All resulting folios are put back to
the list after split. The folio containing the given page is left to
caller to unlock and others are unlocked.
2. buddy allocator like split: old_order - new_order calls to
__split_folio_to_order() are used to split the given folio at order N to
order N-1. After each call, the target folio is changed to the one
containing the page, which is given via folio_split() parameters.
After each call, folios not containing the page are put back to the list.
The folio containing the page is put back to the list when its order
is new_order. All folios are unlocked except the first folio, which
is left to caller to unlock.
Patch Overview
===
1. Patch 1 made file-backed THP split work in split_huge_page_test,
patch 2 enabled shmem large folio split to any lower order, and
patch 3 added tests for splitting file-backed THP to any lower order.
They can be picked independent of this patchset.
2. Patch 4 added __split_unmapped_folio() and __split_folio_to_order() to
prepare for moving to new backend split code.
3. Patch 5 moved common code in split_huge_page_to_list_to_order() to
__folio_split().
4. Patch 6 added new folio_split() and made
split_huge_page_to_list_to_order() share the new
__split_unmapped_folio() with folio_split().
5. Patch 7 removed no longer used __split_huge_page() and
__split_huge_page_tail().
6. Patch 8 added a new in_folio_offset to split_huge_page debugfs for
folio_split() test.
7. Patch 9 used folio_split() for truncate operation.
8. Patch 10 added folio_split() tests.
Any comments and/or suggestions are welcome. Thanks.
[1] https://lore.kernel.org/linux-mm/20241008223748.555845-1-ziy@nvidia.com/
[2] https://lore.kernel.org/linux-mm/20241028180932.1319265-1-ziy@nvidia.com/
[3] https://lore.kernel.org/linux-mm/20241101150357.1752726-1-ziy@nvidia.com/
[4] https://lore.kernel.org/linux-mm/e6ppwz5t4p4kvir6eqzoto4y5fmdjdxdyvxvtw43nc…
[5] https://lore.kernel.org/linux-mm/20241205001839.2582020-1-ziy@nvidia.com/
[6] https://lore.kernel.org/linux-mm/20250106165513.104899-1-ziy@nvidia.com/
Zi Yan (10):
selftests/mm: make file-backed THP split work by setting force option
mm/huge_memory: allow split shmem large folio to any lower order
selftests/mm: test splitting file-backed THP to any lower order.
mm/huge_memory: add two new (not yet used) functions for folio_split()
mm/huge_memory: move folio split common code to __folio_split()
mm/huge_memory: add buddy allocator like folio_split()
mm/huge_memory: remove the old, unused __split_huge_page()
mm/huge_memory: add folio_split() to debugfs testing interface.
mm/truncate: use folio_split() for truncate operation.
selftests/mm: add tests for folio_split(), buddy allocator like split.
include/linux/huge_mm.h | 24 +
mm/huge_memory.c | 755 ++++++++++++------
mm/truncate.c | 31 +-
.../selftests/mm/split_huge_page_test.c | 105 ++-
4 files changed, 633 insertions(+), 282 deletions(-)
--
2.45.2