linux-stable/tools
Vitaly Chikunov 5a7bb2f40c selftests/mm: Fix build with _FORTIFY_SOURCE
[ Upstream commit 8b65ef5ad4 ]

Add missing flags argument to open(2) call with O_CREAT.

Some tests fail to compile if _FORTIFY_SOURCE is defined (to any valid
value) (together with -O), resulting in similar error messages such as:

  In file included from /usr/include/fcntl.h:342,
                   from gup_test.c:1:
  In function 'open',
      inlined from 'main' at gup_test.c:206:10:
  /usr/include/bits/fcntl2.h:50:11: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
     50 |           __open_missing_mode ();
        |           ^~~~~~~~~~~~~~~~~~~~~~

_FORTIFY_SOURCE is enabled by default in some distributions, so the
tests are not built by default and are skipped.

open(2) man-page warns about missing flags argument: "if it is not
supplied, some arbitrary bytes from the stack will be applied as the
file mode."

Link: https://lkml.kernel.org/r/20240318023445.3192922-1-vt@altlinux.org
Fixes: aeb85ed4f4 ("tools/testing/selftests/vm/gup_benchmark.c: allow user specified file")
Fixes: fbe37501b2 ("mm: huge_memory: debugfs for file-backed THP split")
Fixes: c942f5bd17 ("selftests: soft-dirty: add test for mprotect")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:32:35 +02:00
..
accounting
arch work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
bootconfig
bpf tools/resolve_btfids: Fix cross-compilation to non-host endianness 2024-03-26 18:16:40 -04:00
build
certs
cgroup samples: introduce new samples subdir for cgroup 2023-12-10 16:51:54 -08:00
counter tools/counter: Remove unneeded semicolon 2023-12-20 11:43:31 -05:00
crypto crypto: tcrypt - add script tcrypt_speed_compare.py 2023-12-29 11:25:55 +08:00
debugging
edid
firewire
firmware
gpio
hv
iio
include tools/resolve_btfids: Refactor set sorting with types from btf_ids.h 2024-03-26 18:16:40 -04:00
kvm/kvm_stat
laptop
leds
lib libbpf: Use OPTS_SET() macro in bpf_xdp_query() 2024-03-26 18:16:39 -04:00
memory-model
mm
net/ynl tools: ynl: fix handling of multiple mcast groups 2024-02-28 15:24:34 -08:00
objtool objtool: Fix UNWIND_HINT_{SAVE,RESTORE} across basic blocks 2024-03-26 18:16:51 -04:00
pci
pcmcia
perf perf vendor events amd: Fix Zen 4 cache latency events 2024-03-26 18:17:16 -04:00
power tools cpupower bench: Override CFLAGS assignments 2024-01-21 16:57:51 -07:00
rcu
scripts
spi
testing selftests/mm: Fix build with _FORTIFY_SOURCE 2024-04-03 15:32:35 +02:00
thermal tools/thermal/tmon: Fix compilation warning for wrong format 2024-01-02 09:33:19 +01:00
time
tracing tools/rtla: Exit with EXIT_SUCCESS when help is invoked 2024-02-12 10:59:09 +01:00
usb
verification tools/rv: Fix curr_reactor uninitialized variable 2024-02-12 09:58:36 +01:00
virtio
wmi
workqueue
Makefile