2024-05-22 00:59:57

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
redefinitions of _GNU_SOURCE from source code.

809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
asprintf into kselftest_harness.h, which is a GNU extension and needs
_GNU_SOURCE to either be defined prior to including headers or with the
-D_GNU_SOURCE flag passed to the compiler.

v1: https://lore.kernel.org/linux-kselftest/[email protected]/
v2: https://lore.kernel.org/linux-kselftest/[email protected]/
- Add -D_GNU_SOURCE to KHDR_INCLUDES so that it is in a single
location.
- Remove #define _GNU_SOURCE from source code to resolve redefinition
warnings.
v3: https://lore.kernel.org/linux-kselftest/[email protected]/
- Rebase onto linux-next 20240508.
- Split patches by directory.
- Add -D_GNU_SOURCE directly to CFLAGS in lib.mk.
- Delete additional _GNU_SOURCE definitions from source code in
linux-next.
- Delete additional -D_GNU_SOURCE flags from Makefiles.
v4: https://lore.kernel.org/linux-kselftest/[email protected]/
- Rebase onto linux-next 20240509.
- Remove Fixes tag from patches that drop _GNU_SOURCE definition.
- Restore space between comment and includes for selftests/damon.
v5:
- Rebase onto linux-next 20240521
- Drop initial patches that modify KHDR_INCLUDES.
- Incorporate Mark Brown's patch to replace static_assert with warning.
- Don't drop #define _GNU_SOURCE from nolibc and wireguard.
- Change Makefiles for x86 and vDSO to append to CFLAGS.

Edward Liaw (67):
selftests: Compile with -D_GNU_SOURCE when including lib.mk
selftests/arm64: Drop define _GNU_SOURCE
selftests/arm64: Drop duplicate -D_GNU_SOURCE
selftests/bpf: Drop define _GNU_SOURCE
selftests/breakpoints: Drop define _GNU_SOURCE
selftests/cachestat: Drop define _GNU_SOURCE
selftests/capabilities: Drop define _GNU_SOURCE
selftests/cgroup: Drop define _GNU_SOURCE
selftests/clone3: Drop define _GNU_SOURCE
selftests/core: Drop define _GNU_SOURCE
selftests/damon: Drop define _GNU_SOURCE
selftests/drivers: Drop define _GNU_SOURCE
selftests/exec: Drop duplicate -D_GNU_SOURCE
selftests/fchmodat2: Drop define _GNU_SOURCE
selftests/filelock: Drop define _GNU_SOURCE
selftests/filesystems: Drop define _GNU_SOURCE
selftests/firmware: Drop define _GNU_SOURCE
selftests/fpu: Drop define _GNU_SOURCE
selftests/futex: Drop define _GNU_SOURCE
selftests/futex: Drop duplicate -D_GNU_SOURCE
selftests/intel_pstate: Drop duplicate -D_GNU_SOURCE
selftests/iommu: Drop duplicate -D_GNU_SOURCE
selftests/ipc: Drop define _GNU_SOURCE
selftests/kcmp: Drop define _GNU_SOURCE
selftests/landlock: Drop define _GNU_SOURCE
selftests/lsm: Drop define _GNU_SOURCE
selftests/membarrier: Drop define _GNU_SOURCE
selftests/memfd: Drop define _GNU_SOURCE
selftests/mincore: Drop define _GNU_SOURCE
selftests/mm: Drop define _GNU_SOURCE
selftests/mount: Drop define _GNU_SOURCE
selftests/mount_setattr: Drop define _GNU_SOURCE
selftests/move_mount_set_group: Drop define _GNU_SOURCE
selftests/mqueue: Drop define _GNU_SOURCE
selftests/net: Drop define _GNU_SOURCE
selftests/net: Drop duplicate -D_GNU_SOURCE
selftests/nsfs: Drop define _GNU_SOURCE
selftests/openat2: Drop define _GNU_SOURCE
selftests/perf_events: Drop define _GNU_SOURCE
selftests/pid_namespace: Drop define _GNU_SOURCE
selftests/pidfd: Drop define _GNU_SOURCE
selftests/ptrace: Drop define _GNU_SOURCE
selftests/powerpc: Drop define _GNU_SOURCE
selftests/proc: Drop define _GNU_SOURCE
selftests/proc: Drop duplicate -D_GNU_SOURCE
selftests/ptp: Drop define _GNU_SOURCE
selftests/resctrl: Drop duplicate -D_GNU_SOURCE
selftests/riscv: Drop define _GNU_SOURCE
selftests/riscv: Drop duplicate -D_GNU_SOURCE
selftests/rlimits: Drop define _GNU_SOURCE
selftests/rseq: Drop define _GNU_SOURCE
selftests/safesetid: Drop define _GNU_SOURCE
selftests/sched: Drop define _GNU_SOURCE
selftests/seccomp: Drop define _GNU_SOURCE
selftests/sigaltstack: Drop define _GNU_SOURCE
selftests/sgx: Compile with -D_GNU_SOURCE
selftests/splice: Drop define _GNU_SOURCE
selftests/syscall_user_dispatch: Drop define _GNU_SOURCE
selftests/thermal: Drop define _GNU_SOURCE
selftests/timens: Drop define _GNU_SOURCE
selftests/tmpfs: Drop duplicate -D_GNU_SOURCE
selftests/uevent: Drop define _GNU_SOURCE
selftests/user_events: Drop define _GNU_SOURCE
selftests/vDSO: Append to CFLAGS in Makefile
selftests/vDSO: Drop define _GNU_SOURCE
selftests/x86: Append to CFLAGS in Makefile
selftests/x86: Drop define _GNU_SOURCE

Mark Brown (1):
kselftest: Desecalate reporting of missing _GNU_SOURCE

tools/testing/selftests/arm64/fp/fp-ptrace.c | 3 ---
tools/testing/selftests/arm64/fp/fp-stress.c | 2 --
tools/testing/selftests/arm64/fp/vlset.c | 1 -
tools/testing/selftests/arm64/mte/check_buffer_fill.c | 3 ---
tools/testing/selftests/arm64/mte/check_child_memory.c | 3 ---
tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c | 3 ---
tools/testing/selftests/arm64/mte/check_ksm_options.c | 3 ---
tools/testing/selftests/arm64/mte/check_mmap_options.c | 3 ---
tools/testing/selftests/arm64/mte/check_tags_inclusion.c | 3 ---
tools/testing/selftests/arm64/mte/check_user_mem.c | 3 ---
tools/testing/selftests/arm64/pauth/pac.c | 3 ---
tools/testing/selftests/arm64/signal/Makefile | 2 +-
tools/testing/selftests/bpf/bench.c | 1 -
tools/testing/selftests/bpf/benchs/bench_trigger.c | 1 -
tools/testing/selftests/bpf/cgroup_helpers.c | 1 -
tools/testing/selftests/bpf/map_tests/task_storage_map.c | 1 -
tools/testing/selftests/bpf/network_helpers.c | 2 --
tools/testing/selftests/bpf/prog_tests/bind_perm.c | 1 -
tools/testing/selftests/bpf/prog_tests/bpf_cookie.c | 1 -
tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c | 1 -
tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c | 1 -
tools/testing/selftests/bpf/prog_tests/btf_endian.c | 1 -
tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c | 2 --
tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c | 2 --
tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c | 2 --
tools/testing/selftests/bpf/prog_tests/cls_redirect.c | 3 ---
tools/testing/selftests/bpf/prog_tests/connect_ping.c | 2 --
tools/testing/selftests/bpf/prog_tests/core_retro.c | 1 -
tools/testing/selftests/bpf/prog_tests/d_path.c | 1 -
tools/testing/selftests/bpf/prog_tests/deny_namespace.c | 1 -
tools/testing/selftests/bpf/prog_tests/fexit_sleep.c | 1 -
.../selftests/bpf/prog_tests/flow_dissector_reattach.c | 2 --
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c | 1 -
tools/testing/selftests/bpf/prog_tests/htab_reuse.c | 1 -
tools/testing/selftests/bpf/prog_tests/htab_update.c | 1 -
tools/testing/selftests/bpf/prog_tests/map_in_map.c | 1 -
tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 2 --
tools/testing/selftests/bpf/prog_tests/perf_branches.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_buffer.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_link.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_skip.c | 2 --
tools/testing/selftests/bpf/prog_tests/preempted_bpf_ma_op.c | 1 -
tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c | 2 --
tools/testing/selftests/bpf/prog_tests/reg_bounds.c | 2 --
tools/testing/selftests/bpf/prog_tests/ringbuf.c | 1 -
tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c | 1 -
tools/testing/selftests/bpf/prog_tests/setget_sockopt.c | 2 --
tools/testing/selftests/bpf/prog_tests/sk_assign.c | 2 --
tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 2 --
tools/testing/selftests/bpf/prog_tests/sock_fields.c | 2 --
tools/testing/selftests/bpf/prog_tests/task_kfunc.c | 2 --
tools/testing/selftests/bpf/prog_tests/task_local_storage.c | 2 --
tools/testing/selftests/bpf/prog_tests/task_pt_regs.c | 1 -
tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c | 2 --
tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c | 2 --
tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c | 1 -
.../testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c | 1 -
tools/testing/selftests/bpf/prog_tests/test_bpffs.c | 1 -
tools/testing/selftests/bpf/prog_tests/test_overhead.c | 1 -
tools/testing/selftests/bpf/prog_tests/token.c | 1 -
tools/testing/selftests/bpf/prog_tests/trace_ext.c | 2 --
tools/testing/selftests/bpf/prog_tests/trampoline_count.c | 1 -
tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 2 --
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c | 2 --
tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c | 2 --
tools/testing/selftests/bpf/test_flow_dissector.c | 3 ---
tools/testing/selftests/bpf/test_lru_map.c | 1 -
tools/testing/selftests/bpf/test_progs.c | 1 -
tools/testing/selftests/bpf/test_tcpnotify_user.c | 1 -
tools/testing/selftests/bpf/veristat.c | 1 -
tools/testing/selftests/bpf/xskxceiver.c | 2 --
tools/testing/selftests/breakpoints/breakpoint_test_arm64.c | 3 ---
tools/testing/selftests/breakpoints/step_after_suspend_test.c | 3 ---
tools/testing/selftests/cachestat/test_cachestat.c | 2 --
tools/testing/selftests/capabilities/test_execve.c | 2 --
tools/testing/selftests/cgroup/cgroup_util.c | 3 ---
tools/testing/selftests/cgroup/test_core.c | 2 --
tools/testing/selftests/cgroup/test_cpu.c | 2 --
tools/testing/selftests/cgroup/test_hugetlb_memcg.c | 2 --
tools/testing/selftests/cgroup/test_kmem.c | 2 --
tools/testing/selftests/cgroup/test_memcontrol.c | 2 --
tools/testing/selftests/cgroup/test_zswap.c | 2 --
tools/testing/selftests/clone3/clone3.c | 2 --
.../testing/selftests/clone3/clone3_cap_checkpoint_restore.c | 2 --
tools/testing/selftests/clone3/clone3_clear_sighand.c | 2 --
tools/testing/selftests/clone3/clone3_selftests.h | 1 -
tools/testing/selftests/clone3/clone3_set_tid.c | 2 --
tools/testing/selftests/core/close_range_test.c | 2 --
tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c | 2 --
.../damon/debugfs_target_ids_read_before_terminate_race.c | 1 -
tools/testing/selftests/drivers/dma-buf/udmabuf.c | 1 -
tools/testing/selftests/exec/Makefile | 1 -
tools/testing/selftests/fchmodat2/fchmodat2_test.c | 2 --
tools/testing/selftests/filelock/ofdlocks.c | 2 --
tools/testing/selftests/filesystems/binderfs/binderfs_test.c | 2 --
tools/testing/selftests/filesystems/devpts_pts.c | 1 -
tools/testing/selftests/filesystems/dnotify_test.c | 1 -
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c | 2 --
tools/testing/selftests/filesystems/eventfd/eventfd_test.c | 2 --
tools/testing/selftests/filesystems/fat/rename_exchange.c | 2 --
tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c | 2 --
.../testing/selftests/filesystems/statmount/statmount_test.c | 3 ---
tools/testing/selftests/firmware/fw_namespace.c | 1 -
tools/testing/selftests/fpu/test_fpu.c | 2 --
tools/testing/selftests/futex/functional/Makefile | 2 +-
tools/testing/selftests/futex/functional/futex_requeue_pi.c | 3 ---
tools/testing/selftests/intel_pstate/Makefile | 2 +-
tools/testing/selftests/iommu/Makefile | 2 --
tools/testing/selftests/ipc/msgque.c | 1 -
tools/testing/selftests/kcmp/kcmp_test.c | 2 --
tools/testing/selftests/kselftest_harness.h | 2 +-
tools/testing/selftests/landlock/base_test.c | 2 --
tools/testing/selftests/landlock/fs_test.c | 2 --
tools/testing/selftests/landlock/net_test.c | 2 --
tools/testing/selftests/landlock/ptrace_test.c | 2 --
tools/testing/selftests/lib.mk | 3 +++
tools/testing/selftests/lsm/common.c | 2 --
tools/testing/selftests/lsm/lsm_get_self_attr_test.c | 2 --
tools/testing/selftests/lsm/lsm_list_modules_test.c | 2 --
tools/testing/selftests/lsm/lsm_set_self_attr_test.c | 2 --
tools/testing/selftests/membarrier/membarrier_test_impl.h | 1 -
.../selftests/membarrier/membarrier_test_multi_thread.c | 1 -
.../selftests/membarrier/membarrier_test_single_thread.c | 1 -
tools/testing/selftests/memfd/common.c | 1 -
tools/testing/selftests/memfd/fuse_test.c | 2 --
tools/testing/selftests/memfd/memfd_test.c | 1 -
tools/testing/selftests/mincore/mincore_selftest.c | 3 ---
tools/testing/selftests/mm/cow.c | 1 -
tools/testing/selftests/mm/gup_longterm.c | 1 -
tools/testing/selftests/mm/hugepage-mmap.c | 1 -
tools/testing/selftests/mm/hugepage-mremap.c | 2 --
tools/testing/selftests/mm/hugetlb-madvise.c | 2 --
tools/testing/selftests/mm/hugetlb-read-hwpoison.c | 2 --
tools/testing/selftests/mm/khugepaged.c | 1 -
tools/testing/selftests/mm/ksm_functional_tests.c | 1 -
tools/testing/selftests/mm/madv_populate.c | 1 -
tools/testing/selftests/mm/map_populate.c | 2 --
tools/testing/selftests/mm/memfd_secret.c | 2 --
tools/testing/selftests/mm/mlock2-tests.c | 1 -
tools/testing/selftests/mm/mrelease_test.c | 1 -
tools/testing/selftests/mm/mremap_dontunmap.c | 1 -
tools/testing/selftests/mm/mremap_test.c | 2 --
tools/testing/selftests/mm/mseal_test.c | 1 -
tools/testing/selftests/mm/pagemap_ioctl.c | 1 -
tools/testing/selftests/mm/pkey-helpers.h | 1 -
tools/testing/selftests/mm/protection_keys.c | 1 -
tools/testing/selftests/mm/seal_elf.c | 1 -
tools/testing/selftests/mm/split_huge_page_test.c | 2 --
tools/testing/selftests/mm/thuge-gen.c | 2 --
tools/testing/selftests/mm/uffd-common.h | 1 -
tools/testing/selftests/mount/nosymfollow-test.c | 1 -
tools/testing/selftests/mount/unprivileged-remount-test.c | 1 -
tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 -
.../move_mount_set_group/move_mount_set_group_test.c | 1 -
tools/testing/selftests/mqueue/mq_perf_tests.c | 1 -
tools/testing/selftests/net/af_unix/diag_uid.c | 2 --
tools/testing/selftests/net/af_unix/scm_pidfd.c | 1 -
tools/testing/selftests/net/af_unix/scm_rights.c | 1 -
tools/testing/selftests/net/af_unix/unix_connect.c | 2 --
tools/testing/selftests/net/epoll_busy_poll.c | 2 --
tools/testing/selftests/net/gro.c | 3 ---
tools/testing/selftests/net/ip_defrag.c | 3 ---
tools/testing/selftests/net/ipsec.c | 3 ---
tools/testing/selftests/net/ipv6_flowlabel.c | 3 ---
tools/testing/selftests/net/ipv6_flowlabel_mgr.c | 3 ---
tools/testing/selftests/net/lib/csum.c | 3 ---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ---
tools/testing/selftests/net/mptcp/mptcp_inq.c | 3 ---
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 3 ---
tools/testing/selftests/net/msg_zerocopy.c | 3 ---
tools/testing/selftests/net/netfilter/audit_logread.c | 2 --
tools/testing/selftests/net/netfilter/conntrack_dump_flush.c | 3 ---
tools/testing/selftests/net/nettest.c | 2 --
tools/testing/selftests/net/psock_fanout.c | 3 ---
tools/testing/selftests/net/psock_snd.c | 3 ---
tools/testing/selftests/net/reuseport_addr_any.c | 3 ---
tools/testing/selftests/net/reuseport_bpf_cpu.c | 3 ---
tools/testing/selftests/net/reuseport_bpf_numa.c | 3 ---
tools/testing/selftests/net/reuseport_dualstack.c | 3 ---
tools/testing/selftests/net/so_incoming_cpu.c | 1 -
tools/testing/selftests/net/so_netns_cookie.c | 1 -
tools/testing/selftests/net/so_txtime.c | 3 ---
tools/testing/selftests/net/tap.c | 3 ---
tools/testing/selftests/net/tcp_ao/Makefile | 2 +-
tools/testing/selftests/net/tcp_fastopen_backup_key.c | 1 -
tools/testing/selftests/net/tcp_inq.c | 2 --
tools/testing/selftests/net/tcp_mmap.c | 1 -
tools/testing/selftests/net/tls.c | 3 ---
tools/testing/selftests/net/toeplitz.c | 3 ---
tools/testing/selftests/net/tun.c | 3 ---
tools/testing/selftests/net/txring_overwrite.c | 3 ---
tools/testing/selftests/net/txtimestamp.c | 3 ---
tools/testing/selftests/net/udpgso.c | 3 ---
tools/testing/selftests/net/udpgso_bench_rx.c | 3 ---
tools/testing/selftests/net/udpgso_bench_tx.c | 3 ---
tools/testing/selftests/nsfs/owner.c | 1 -
tools/testing/selftests/nsfs/pidns.c | 1 -
tools/testing/selftests/openat2/helpers.c | 2 --
tools/testing/selftests/openat2/helpers.h | 1 -
tools/testing/selftests/openat2/openat2_test.c | 2 --
tools/testing/selftests/openat2/rename_attack_test.c | 2 --
tools/testing/selftests/openat2/resolve_test.c | 2 --
tools/testing/selftests/perf_events/remove_on_exec.c | 2 --
tools/testing/selftests/perf_events/sigtrap_threads.c | 2 --
tools/testing/selftests/perf_events/watermark_signal.c | 2 --
tools/testing/selftests/pid_namespace/regression_enomem.c | 1 -
tools/testing/selftests/pidfd/pidfd.h | 1 -
tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_getfd_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_open_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_poll_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_setns_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_wait.c | 2 --
tools/testing/selftests/powerpc/benchmarks/context_switch.c | 2 --
tools/testing/selftests/powerpc/benchmarks/exec_target.c | 2 --
tools/testing/selftests/powerpc/benchmarks/fork.c | 2 --
tools/testing/selftests/powerpc/benchmarks/futex_bench.c | 3 ---
tools/testing/selftests/powerpc/dexcr/hashchk_test.c | 3 ---
tools/testing/selftests/powerpc/dscr/dscr_default_test.c | 3 ---
tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c | 3 ---
tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c | 1 -
tools/testing/selftests/powerpc/mm/exec_prot.c | 2 --
tools/testing/selftests/powerpc/mm/pkey_exec_prot.c | 2 --
tools/testing/selftests/powerpc/mm/pkey_siginfo.c | 2 --
tools/testing/selftests/powerpc/mm/tlbie_test.c | 2 --
tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c | 1 -
tools/testing/selftests/powerpc/pmu/count_instructions.c | 3 ---
tools/testing/selftests/powerpc/pmu/count_stcx_fail.c | 3 ---
tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 3 ---
.../selftests/powerpc/pmu/ebb/instruction_count_test.c | 3 ---
tools/testing/selftests/powerpc/pmu/event.c | 2 --
tools/testing/selftests/powerpc/pmu/lib.c | 3 ---
tools/testing/selftests/powerpc/pmu/per_event_excludes.c | 3 ---
tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c | 3 ---
tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c | 2 --
.../testing/selftests/powerpc/signal/sig_sc_double_restart.c | 1 -
tools/testing/selftests/powerpc/signal/sigreturn_kernel.c | 3 ---
tools/testing/selftests/powerpc/signal/sigreturn_vdso.c | 3 ---
tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c | 2 --
tools/testing/selftests/powerpc/tm/tm-exec.c | 2 --
tools/testing/selftests/powerpc/tm/tm-poison.c | 2 --
.../testing/selftests/powerpc/tm/tm-signal-context-force-tm.c | 2 --
tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c | 2 --
tools/testing/selftests/powerpc/tm/tm-tmspr.c | 2 --
tools/testing/selftests/powerpc/tm/tm-trap.c | 2 --
tools/testing/selftests/powerpc/tm/tm-unavailable.c | 2 --
tools/testing/selftests/powerpc/utils.c | 3 ---
tools/testing/selftests/proc/Makefile | 1 -
tools/testing/selftests/proc/proc-empty-vm.c | 3 ---
tools/testing/selftests/ptp/testptp.c | 1 -
tools/testing/selftests/ptrace/get_set_sud.c | 1 -
tools/testing/selftests/ptrace/peeksiginfo.c | 1 -
tools/testing/selftests/resctrl/Makefile | 2 +-
tools/testing/selftests/riscv/hwprobe/cbo.c | 1 -
tools/testing/selftests/riscv/hwprobe/which-cpus.c | 1 -
tools/testing/selftests/riscv/mm/Makefile | 2 +-
tools/testing/selftests/rlimits/rlimits-per-userns.c | 1 -
tools/testing/selftests/rseq/basic_percpu_ops_test.c | 1 -
tools/testing/selftests/rseq/basic_test.c | 2 --
tools/testing/selftests/rseq/param_test.c | 1 -
tools/testing/selftests/rseq/rseq.c | 2 --
tools/testing/selftests/safesetid/safesetid-test.c | 1 -
tools/testing/selftests/sched/cs_prctl_test.c | 2 --
tools/testing/selftests/seccomp/seccomp_benchmark.c | 1 -
tools/testing/selftests/seccomp/seccomp_bpf.c | 2 --
tools/testing/selftests/sgx/Makefile | 2 +-
tools/testing/selftests/sgx/sigstruct.c | 1 -
tools/testing/selftests/sigaltstack/sas.c | 2 --
tools/testing/selftests/splice/default_file_splice_read.c | 1 -
tools/testing/selftests/splice/splice_read.c | 1 -
tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c | 2 --
tools/testing/selftests/syscall_user_dispatch/sud_test.c | 2 --
.../selftests/thermal/intel/power_floor/power_floor_test.c | 3 ---
.../thermal/intel/workload_hint/workload_hint_test.c | 3 ---
tools/testing/selftests/timens/clock_nanosleep.c | 1 -
tools/testing/selftests/timens/exec.c | 1 -
tools/testing/selftests/timens/futex.c | 1 -
tools/testing/selftests/timens/gettime_perf.c | 1 -
tools/testing/selftests/timens/procfs.c | 1 -
tools/testing/selftests/timens/timens.c | 1 -
tools/testing/selftests/timens/timer.c | 1 -
tools/testing/selftests/timens/timerfd.c | 1 -
tools/testing/selftests/timens/vfork_exec.c | 1 -
tools/testing/selftests/tmpfs/Makefile | 1 -
tools/testing/selftests/uevent/uevent_filtering.c | 2 --
tools/testing/selftests/user_events/abi_test.c | 2 --
tools/testing/selftests/vDSO/Makefile | 2 +-
tools/testing/selftests/vDSO/vdso_test_abi.c | 1 -
tools/testing/selftests/vDSO/vdso_test_clock_getres.c | 2 --
tools/testing/selftests/vDSO/vdso_test_correctness.c | 3 ---
tools/testing/selftests/x86/Makefile | 2 +-
tools/testing/selftests/x86/amx.c | 2 --
tools/testing/selftests/x86/check_initial_reg_state.c | 3 ---
tools/testing/selftests/x86/corrupt_xstate_header.c | 3 ---
tools/testing/selftests/x86/entry_from_vm86.c | 3 ---
tools/testing/selftests/x86/fsgsbase.c | 2 --
tools/testing/selftests/x86/fsgsbase_restore.c | 2 --
tools/testing/selftests/x86/ioperm.c | 2 --
tools/testing/selftests/x86/iopl.c | 2 --
tools/testing/selftests/x86/lam.c | 1 -
tools/testing/selftests/x86/ldt_gdt.c | 2 --
tools/testing/selftests/x86/mov_ss_trap.c | 2 --
tools/testing/selftests/x86/nx_stack.c | 2 --
tools/testing/selftests/x86/ptrace_syscall.c | 2 --
tools/testing/selftests/x86/sigaltstack.c | 2 --
tools/testing/selftests/x86/sigreturn.c | 3 ---
tools/testing/selftests/x86/single_step_syscall.c | 3 ---
tools/testing/selftests/x86/syscall_arg_fault.c | 3 ---
tools/testing/selftests/x86/syscall_numbering.c | 3 ---
tools/testing/selftests/x86/sysret_rip.c | 3 ---
tools/testing/selftests/x86/sysret_ss_attrs.c | 3 ---
tools/testing/selftests/x86/test_FCMOV.c | 4 ----
tools/testing/selftests/x86/test_FCOMI.c | 4 ----
tools/testing/selftests/x86/test_FISTTP.c | 4 ----
tools/testing/selftests/x86/test_mremap_vdso.c | 1 -
tools/testing/selftests/x86/test_shadow_stack.c | 3 ---
tools/testing/selftests/x86/test_syscall_vdso.c | 4 ----
tools/testing/selftests/x86/test_vsyscall.c | 3 ---
tools/testing/selftests/x86/unwind_vdso.c | 3 ---
tools/testing/selftests/x86/vdso_restorer.c | 3 ---
322 files changed, 13 insertions(+), 605 deletions(-)

--
2.45.1.288.g0e0cd299f1-goog



2024-05-22 01:00:22

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 01/68] selftests: Compile with -D_GNU_SOURCE when including lib.mk

lib.mk will add -D_GNU_SOURCE to CFLAGS by default. This will make it
unnecessary to add #define _GNU_SOURCE in the source code.

Suggested-by: John Hubbard <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/lib.mk | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 429535816dbd..e782f4c96aee 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -188,6 +188,9 @@ endef
clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
$(CLEAN)

+# Build with _GNU_SOURCE by default
+CFLAGS += -D_GNU_SOURCE
+
# Enables to extend CFLAGS and LDFLAGS from command line, e.g.
# make USERCFLAGS=-Werror USERLDFLAGS=-static
CFLAGS += $(USERCFLAGS)
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:00:22

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

From: Mark Brown <[email protected]>

Commit daef47b89efd0b7 ("selftests: Compile kselftest headers with
-D_GNU_SOURCE") adds a static_assert() which means that things which
would be warnings about undeclared functions get escalated into build
failures. While we do actually want _GNU_SOURCE to be defined for users
of kselftest_harness we haven't actually done that yet and this is
causing widespread build breaks which were previously warnings about
uses of asprintf() without prototypes, including causing other test
programs in the same directory to fail to build.

Since the build failures that are introduced cause additional issues due
to make stopping builds early replace the static_assert() with a
missing without making the error more severe than it already was. This
will be moot once the issue is fixed properly but reduces the disruption
while that happens.

Signed-off-by: Mark Brown <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
---
tools/testing/selftests/kselftest_harness.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index b634969cbb6f..8e53686b71cb 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -51,7 +51,7 @@
#define __KSELFTEST_HARNESS_H

#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
+#warning kselftest harness requires _GNU_SOURCE to be defined
#endif
#include <asm/types.h>
#include <ctype.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:01:01

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 03/68] selftests/arm64: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/arm64/fp/fp-ptrace.c | 3 ---
tools/testing/selftests/arm64/fp/fp-stress.c | 2 --
tools/testing/selftests/arm64/fp/vlset.c | 1 -
tools/testing/selftests/arm64/mte/check_buffer_fill.c | 3 ---
tools/testing/selftests/arm64/mte/check_child_memory.c | 3 ---
tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c | 3 ---
tools/testing/selftests/arm64/mte/check_ksm_options.c | 3 ---
tools/testing/selftests/arm64/mte/check_mmap_options.c | 3 ---
tools/testing/selftests/arm64/mte/check_tags_inclusion.c | 3 ---
tools/testing/selftests/arm64/mte/check_user_mem.c | 3 ---
tools/testing/selftests/arm64/pauth/pac.c | 3 ---
11 files changed, 30 deletions(-)

diff --git a/tools/testing/selftests/arm64/fp/fp-ptrace.c b/tools/testing/selftests/arm64/fp/fp-ptrace.c
index c7ceafe5f471..eb1f14047361 100644
--- a/tools/testing/selftests/arm64/fp/fp-ptrace.c
+++ b/tools/testing/selftests/arm64/fp/fp-ptrace.c
@@ -3,9 +3,6 @@
* Copyright (C) 2023 ARM Limited.
* Original author: Mark Brown <[email protected]>
*/
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
diff --git a/tools/testing/selftests/arm64/fp/fp-stress.c b/tools/testing/selftests/arm64/fp/fp-stress.c
index dd31647b00a2..042f736970c2 100644
--- a/tools/testing/selftests/arm64/fp/fp-stress.c
+++ b/tools/testing/selftests/arm64/fp/fp-stress.c
@@ -2,8 +2,6 @@
/*
* Copyright (C) 2022 ARM Limited.
*/
-
-#define _GNU_SOURCE
#define _POSIX_C_SOURCE 199309L

#include <errno.h>
diff --git a/tools/testing/selftests/arm64/fp/vlset.c b/tools/testing/selftests/arm64/fp/vlset.c
index 76912a581a95..e572c0483c3a 100644
--- a/tools/testing/selftests/arm64/fp/vlset.c
+++ b/tools/testing/selftests/arm64/fp/vlset.c
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2019 ARM Limited.
* Original author: Dave Martin <[email protected]>
*/
-#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <limits.h>
diff --git a/tools/testing/selftests/arm64/mte/check_buffer_fill.c b/tools/testing/selftests/arm64/mte/check_buffer_fill.c
index 1dbbbd47dd50..c0d91f0c7a4d 100644
--- a/tools/testing/selftests/arm64/mte/check_buffer_fill.c
+++ b/tools/testing/selftests/arm64/mte/check_buffer_fill.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <stddef.h>
#include <stdio.h>
#include <string.h>
diff --git a/tools/testing/selftests/arm64/mte/check_child_memory.c b/tools/testing/selftests/arm64/mte/check_child_memory.c
index 7597fc632cad..ef69abc7c82d 100644
--- a/tools/testing/selftests/arm64/mte/check_child_memory.c
+++ b/tools/testing/selftests/arm64/mte/check_child_memory.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <signal.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c b/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
index 325bca0de0f6..aaa5519c6bbd 100644
--- a/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
+++ b/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <pthread.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/arm64/mte/check_ksm_options.c b/tools/testing/selftests/arm64/mte/check_ksm_options.c
index 88c74bc46d4f..76357f914125 100644
--- a/tools/testing/selftests/arm64/mte/check_ksm_options.c
+++ b/tools/testing/selftests/arm64/mte/check_ksm_options.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
diff --git a/tools/testing/selftests/arm64/mte/check_mmap_options.c b/tools/testing/selftests/arm64/mte/check_mmap_options.c
index 17694caaff53..66bddc8fe385 100644
--- a/tools/testing/selftests/arm64/mte/check_mmap_options.c
+++ b/tools/testing/selftests/arm64/mte/check_mmap_options.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
diff --git a/tools/testing/selftests/arm64/mte/check_tags_inclusion.c b/tools/testing/selftests/arm64/mte/check_tags_inclusion.c
index 2b1425b92b69..e66d8b8d5bdc 100644
--- a/tools/testing/selftests/arm64/mte/check_tags_inclusion.c
+++ b/tools/testing/selftests/arm64/mte/check_tags_inclusion.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <signal.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c
index f4ae5f87a3b7..220a8795d889 100644
--- a/tools/testing/selftests/arm64/mte/check_user_mem.c
+++ b/tools/testing/selftests/arm64/mte/check_user_mem.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/arm64/pauth/pac.c b/tools/testing/selftests/arm64/pauth/pac.c
index b743daa772f5..b5205c2fc652 100644
--- a/tools/testing/selftests/arm64/pauth/pac.c
+++ b/tools/testing/selftests/arm64/pauth/pac.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 ARM Limited
-
-#define _GNU_SOURCE
-
#include <sys/auxv.h>
#include <sys/types.h>
#include <sys/wait.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:01:31

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 04/68] selftests/arm64: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/arm64/signal/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/arm64/signal/Makefile b/tools/testing/selftests/arm64/signal/Makefile
index 8f5febaf1a9a..37c8207b99cf 100644
--- a/tools/testing/selftests/arm64/signal/Makefile
+++ b/tools/testing/selftests/arm64/signal/Makefile
@@ -2,7 +2,7 @@
# Copyright (C) 2019 ARM Limited

# Additional include paths needed by kselftest.h and local headers
-CFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
+CFLAGS += -std=gnu99 -I.

SRCS := $(filter-out testcases/testcases.c,$(wildcard testcases/*.c))
PROGS := $(patsubst %.c,%,$(SRCS))
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:02:56

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 05/68] selftests/bpf: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/bpf/bench.c | 1 -
tools/testing/selftests/bpf/benchs/bench_trigger.c | 1 -
tools/testing/selftests/bpf/cgroup_helpers.c | 1 -
tools/testing/selftests/bpf/map_tests/task_storage_map.c | 1 -
tools/testing/selftests/bpf/network_helpers.c | 2 --
tools/testing/selftests/bpf/prog_tests/bind_perm.c | 1 -
tools/testing/selftests/bpf/prog_tests/bpf_cookie.c | 1 -
tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c | 1 -
tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c | 1 -
tools/testing/selftests/bpf/prog_tests/btf_endian.c | 1 -
tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c | 2 --
tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c | 2 --
tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c | 2 --
tools/testing/selftests/bpf/prog_tests/cls_redirect.c | 3 ---
tools/testing/selftests/bpf/prog_tests/connect_ping.c | 2 --
tools/testing/selftests/bpf/prog_tests/core_retro.c | 1 -
tools/testing/selftests/bpf/prog_tests/d_path.c | 1 -
tools/testing/selftests/bpf/prog_tests/deny_namespace.c | 1 -
tools/testing/selftests/bpf/prog_tests/fexit_sleep.c | 1 -
.../testing/selftests/bpf/prog_tests/flow_dissector_reattach.c | 2 --
tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c | 1 -
tools/testing/selftests/bpf/prog_tests/htab_reuse.c | 1 -
tools/testing/selftests/bpf/prog_tests/htab_update.c | 1 -
tools/testing/selftests/bpf/prog_tests/map_in_map.c | 1 -
tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 2 --
tools/testing/selftests/bpf/prog_tests/perf_branches.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_buffer.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_link.c | 1 -
tools/testing/selftests/bpf/prog_tests/perf_skip.c | 2 --
tools/testing/selftests/bpf/prog_tests/preempted_bpf_ma_op.c | 1 -
tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c | 2 --
tools/testing/selftests/bpf/prog_tests/reg_bounds.c | 2 --
tools/testing/selftests/bpf/prog_tests/ringbuf.c | 1 -
tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c | 1 -
tools/testing/selftests/bpf/prog_tests/setget_sockopt.c | 2 --
tools/testing/selftests/bpf/prog_tests/sk_assign.c | 2 --
tools/testing/selftests/bpf/prog_tests/sk_lookup.c | 2 --
tools/testing/selftests/bpf/prog_tests/sock_fields.c | 2 --
tools/testing/selftests/bpf/prog_tests/task_kfunc.c | 2 --
tools/testing/selftests/bpf/prog_tests/task_local_storage.c | 2 --
tools/testing/selftests/bpf/prog_tests/task_pt_regs.c | 1 -
tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c | 2 --
tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c | 2 --
tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c | 1 -
.../testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c | 1 -
tools/testing/selftests/bpf/prog_tests/test_bpffs.c | 1 -
tools/testing/selftests/bpf/prog_tests/test_overhead.c | 1 -
tools/testing/selftests/bpf/prog_tests/token.c | 1 -
tools/testing/selftests/bpf/prog_tests/trace_ext.c | 2 --
tools/testing/selftests/bpf/prog_tests/trampoline_count.c | 1 -
tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 2 --
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c | 2 --
tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c | 2 --
tools/testing/selftests/bpf/test_flow_dissector.c | 3 ---
tools/testing/selftests/bpf/test_lru_map.c | 1 -
tools/testing/selftests/bpf/test_progs.c | 1 -
tools/testing/selftests/bpf/test_tcpnotify_user.c | 1 -
tools/testing/selftests/bpf/veristat.c | 1 -
tools/testing/selftests/bpf/xskxceiver.c | 2 --
60 files changed, 87 deletions(-)

diff --git a/tools/testing/selftests/bpf/bench.c b/tools/testing/selftests/bpf/bench.c
index 627b74ae041b..ab06bd67a22c 100644
--- a/tools/testing/selftests/bpf/bench.c
+++ b/tools/testing/selftests/bpf/bench.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
-#define _GNU_SOURCE
#include <argp.h>
#include <linux/compiler.h>
#include <sys/time.h>
diff --git a/tools/testing/selftests/bpf/benchs/bench_trigger.c b/tools/testing/selftests/bpf/benchs/bench_trigger.c
index 4b05539f167d..dc84469cbfa6 100644
--- a/tools/testing/selftests/bpf/benchs/bench_trigger.c
+++ b/tools/testing/selftests/bpf/benchs/bench_trigger.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
-#define _GNU_SOURCE
#include <argp.h>
#include <unistd.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index 23bb9a9e6a7d..3040ba7cc9ba 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <sys/mount.h>
#include <sys/stat.h>
diff --git a/tools/testing/selftests/bpf/map_tests/task_storage_map.c b/tools/testing/selftests/bpf/map_tests/task_storage_map.c
index 7d050364efca..89ff4ed5c59b 100644
--- a/tools/testing/selftests/bpf/map_tests/task_storage_map.c
+++ b/tools/testing/selftests/bpf/map_tests/task_storage_map.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2022. Huawei Technologies Co., Ltd */
-#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c
index 35250e6cde7f..3979a6491282 100644
--- a/tools/testing/selftests/bpf/network_helpers.c
+++ b/tools/testing/selftests/bpf/network_helpers.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE
-
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/bind_perm.c b/tools/testing/selftests/bpf/prog_tests/bind_perm.c
index f7cd129cb82b..c3839f425ba5 100644
--- a/tools/testing/selftests/bpf/prog_tests/bind_perm.c
+++ b/tools/testing/selftests/bpf/prog_tests/bind_perm.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <stdlib.h>
#include <sys/types.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
index 4407ea428e77..a47f453dd7e8 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
-#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <sys/syscall.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c
index b52ff8ce34db..be8a401eb07a 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
-#define _GNU_SOURCE
#include <sched.h>
#include <test_progs.h>
#include "network_helpers.h"
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c b/tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c
index ee0458a5ce78..e33129203194 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_obj_pinning.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
-#define _GNU_SOURCE
#include <test_progs.h>
#include <bpf/btf.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/btf_endian.c b/tools/testing/selftests/bpf/prog_tests/btf_endian.c
index 5b9f84dbeb43..460b117507bb 100644
--- a/tools/testing/selftests/bpf/prog_tests/btf_endian.c
+++ b/tools/testing/selftests/bpf/prog_tests/btf_endian.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
-#define _GNU_SOURCE
#include <string.h>
#include <byteswap.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c b/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c
index ef4d6a3ae423..1a90d6638147 100644
--- a/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c
+++ b/tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
-
-#define _GNU_SOURCE
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c b/tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c
index adda85f97058..7f1a6ffdda98 100644
--- a/tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c
+++ b/tools/testing/selftests/bpf/prog_tests/cgrp_kfunc.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
-
-#define _GNU_SOURCE
#include <cgroup_helpers.h>
#include <test_progs.h>

diff --git a/tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c b/tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c
index 747761572098..accd25c2b638 100644
--- a/tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c
+++ b/tools/testing/selftests/bpf/prog_tests/cgrp_local_storage.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates.*/
-
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/cls_redirect.c b/tools/testing/selftests/bpf/prog_tests/cls_redirect.c
index 34b59f6baca1..598461560fa1 100644
--- a/tools/testing/selftests/bpf/prog_tests/cls_redirect.c
+++ b/tools/testing/selftests/bpf/prog_tests/cls_redirect.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
// Copyright (c) 2020 Cloudflare
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <string.h>

diff --git a/tools/testing/selftests/bpf/prog_tests/connect_ping.c b/tools/testing/selftests/bpf/prog_tests/connect_ping.c
index 40fe571f2fe7..f315f09391f7 100644
--- a/tools/testing/selftests/bpf/prog_tests/connect_ping.c
+++ b/tools/testing/selftests/bpf/prog_tests/connect_ping.c
@@ -3,8 +3,6 @@
/*
* Copyright 2022 Google LLC.
*/
-
-#define _GNU_SOURCE
#include <sys/mount.h>

#include "test_progs.h"
diff --git a/tools/testing/selftests/bpf/prog_tests/core_retro.c b/tools/testing/selftests/bpf/prog_tests/core_retro.c
index 4a2c256c8db6..bb1b2ae3502f 100644
--- a/tools/testing/selftests/bpf/prog_tests/core_retro.c
+++ b/tools/testing/selftests/bpf/prog_tests/core_retro.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Facebook
-#define _GNU_SOURCE
#include <test_progs.h>
#include "test_core_retro.skel.h"

diff --git a/tools/testing/selftests/bpf/prog_tests/d_path.c b/tools/testing/selftests/bpf/prog_tests/d_path.c
index ccc768592e66..7f172296c4a1 100644
--- a/tools/testing/selftests/bpf/prog_tests/d_path.c
+++ b/tools/testing/selftests/bpf/prog_tests/d_path.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <test_progs.h>
#include <sys/stat.h>
#include <linux/sched.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/deny_namespace.c b/tools/testing/selftests/bpf/prog_tests/deny_namespace.c
index 1bc6241b755b..ff8d03a906a3 100644
--- a/tools/testing/selftests/bpf/prog_tests/deny_namespace.c
+++ b/tools/testing/selftests/bpf/prog_tests/deny_namespace.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <test_progs.h>
#include "test_deny_namespace.skel.h"
#include <sched.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_sleep.c b/tools/testing/selftests/bpf/prog_tests/fexit_sleep.c
index f949647dbbc2..4f58a08db082 100644
--- a/tools/testing/selftests/bpf/prog_tests/fexit_sleep.c
+++ b/tools/testing/selftests/bpf/prog_tests/fexit_sleep.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
-#define _GNU_SOURCE
#include <sched.h>
#include <test_progs.h>
#include <time.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
index 9333f7346d15..1f64ffc9a036 100644
--- a/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
+++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
@@ -2,8 +2,6 @@
/*
* Tests for attaching, detaching, and replacing flow_dissector BPF program.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
index 858e0575f502..080a94cde2dc 100644
--- a/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
+++ b/tools/testing/selftests/bpf/prog_tests/get_stack_raw_tp.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <sys/socket.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/htab_reuse.c b/tools/testing/selftests/bpf/prog_tests/htab_reuse.c
index a742dd994d60..c80f97405cc2 100644
--- a/tools/testing/selftests/bpf/prog_tests/htab_reuse.c
+++ b/tools/testing/selftests/bpf/prog_tests/htab_reuse.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2023. Huawei Technologies Co., Ltd */
-#define _GNU_SOURCE
#include <sched.h>
#include <stdbool.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/htab_update.c b/tools/testing/selftests/bpf/prog_tests/htab_update.c
index 2bc85f4814f4..37fa7fd75858 100644
--- a/tools/testing/selftests/bpf/prog_tests/htab_update.c
+++ b/tools/testing/selftests/bpf/prog_tests/htab_update.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2022. Huawei Technologies Co., Ltd */
-#define _GNU_SOURCE
#include <sched.h>
#include <stdbool.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/map_in_map.c b/tools/testing/selftests/bpf/prog_tests/map_in_map.c
index d2a10eb4e5b5..51157f4f4ad6 100644
--- a/tools/testing/selftests/bpf/prog_tests/map_in_map.c
+++ b/tools/testing/selftests/bpf/prog_tests/map_in_map.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2023. Huawei Technologies Co., Ltd */
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
index e72d75d6baa7..fa8c570584d3 100644
--- a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
+++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Carlos Neira [email protected] */
-
-#define _GNU_SOURCE
#include <test_progs.h>
#include "test_ns_current_pid_tgid.skel.h"
#include <sys/stat.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/perf_branches.c b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
index bc24f83339d6..d7b6e9405260 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_branches.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <sys/socket.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/perf_buffer.c b/tools/testing/selftests/bpf/prog_tests/perf_buffer.c
index 5fc2b3a0711e..d3775af00b0b 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_buffer.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_buffer.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <sys/socket.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c b/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
index f4aad35afae1..5edbeaf45459 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Facebook
-#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/perf_link.c b/tools/testing/selftests/bpf/prog_tests/perf_link.c
index 3a25f1c743a1..083680a47748 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_link.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_link.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
-#define _GNU_SOURCE
#include <pthread.h>
#include <sched.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/perf_skip.c b/tools/testing/selftests/bpf/prog_tests/perf_skip.c
index 37d8618800e4..92bee9815834 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_skip.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_skip.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <test_progs.h>
#include "test_perf_skip.skel.h"
#include <linux/compiler.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/preempted_bpf_ma_op.c b/tools/testing/selftests/bpf/prog_tests/preempted_bpf_ma_op.c
index 3a2ec3923fca..63356b8410e8 100644
--- a/tools/testing/selftests/bpf/prog_tests/preempted_bpf_ma_op.c
+++ b/tools/testing/selftests/bpf/prog_tests/preempted_bpf_ma_op.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2023. Huawei Technologies Co., Ltd */
-#define _GNU_SOURCE
#include <sched.h>
#include <pthread.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c b/tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c
index a1f7e7378a64..da4391d9105d 100644
--- a/tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c
+++ b/tools/testing/selftests/bpf/prog_tests/rcu_read_lock.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates.*/
-
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/types.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c
index eb74363f9f70..ba59d6ef1c57 100644
--- a/tools/testing/selftests/bpf/prog_tests/reg_bounds.c
+++ b/tools/testing/selftests/bpf/prog_tests/reg_bounds.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
-
-#define _GNU_SOURCE
#include <limits.h>
#include <test_progs.h>
#include <linux/filter.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf.c b/tools/testing/selftests/bpf/prog_tests/ringbuf.c
index 4c6f42dae409..0091a42f88ce 100644
--- a/tools/testing/selftests/bpf/prog_tests/ringbuf.c
+++ b/tools/testing/selftests/bpf/prog_tests/ringbuf.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <linux/compiler.h>
#include <asm/barrier.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c b/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c
index 58522195081b..3dce8575fbb4 100644
--- a/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c
+++ b/tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <test_progs.h>
#include <sys/epoll.h>
#include "test_ringbuf_multi.skel.h"
diff --git a/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c b/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c
index 7d4a9b3d3722..fc20202d87c8 100644
--- a/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c
+++ b/tools/testing/selftests/bpf/prog_tests/setget_sockopt.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) Meta Platforms, Inc. and affiliates. */
-
-#define _GNU_SOURCE
#include <sched.h>
#include <linux/socket.h>
#include <linux/tls.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/sk_assign.c b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
index 0b9bd1d6f7cc..da3e2e98a894 100644
--- a/tools/testing/selftests/bpf/prog_tests/sk_assign.c
+++ b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
@@ -7,8 +7,6 @@
* socket, regardless of whether the port or address destination of the traffic
* matches the port.
*/
-
-#define _GNU_SOURCE
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/sk_lookup.c b/tools/testing/selftests/bpf/prog_tests/sk_lookup.c
index 597d0467a926..86d4831133db 100644
--- a/tools/testing/selftests/bpf/prog_tests/sk_lookup.c
+++ b/tools/testing/selftests/bpf/prog_tests/sk_lookup.c
@@ -13,8 +13,6 @@
*
* Tests run in a dedicated network namespace.
*/
-
-#define _GNU_SOURCE
#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/sock_fields.c b/tools/testing/selftests/bpf/prog_tests/sock_fields.c
index 7d23166c77af..8159bcac07df 100644
--- a/tools/testing/selftests/bpf/prog_tests/sock_fields.c
+++ b/tools/testing/selftests/bpf/prog_tests/sock_fields.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 Facebook */
-
-#define _GNU_SOURCE
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/task_kfunc.c b/tools/testing/selftests/bpf/prog_tests/task_kfunc.c
index d4579f735398..a3964524120f 100644
--- a/tools/testing/selftests/bpf/prog_tests/task_kfunc.c
+++ b/tools/testing/selftests/bpf/prog_tests/task_kfunc.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
-
-#define _GNU_SOURCE
#include <sys/wait.h>
#include <test_progs.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/task_local_storage.c b/tools/testing/selftests/bpf/prog_tests/task_local_storage.c
index c33c05161a9e..6ba2ea723d4e 100644
--- a/tools/testing/selftests/bpf/prog_tests/task_local_storage.c
+++ b/tools/testing/selftests/bpf/prog_tests/task_local_storage.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2021 Facebook */
-
-#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
#include <sched.h>
#include <pthread.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c b/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
index f000734a3d1f..87237ecdb3eb 100644
--- a/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
+++ b/tools/testing/selftests/bpf/prog_tests/task_pt_regs.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <test_progs.h>
#include "test_task_pt_regs.skel.h"

diff --git a/tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c b/tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c
index eaf441dc7e79..05f1b3aa5ebd 100644
--- a/tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c
+++ b/tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright Amazon.com Inc. or its affiliates. */
-
-#define _GNU_SOURCE
#include <sched.h>
#include <stdlib.h>
#include <net/if.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c b/tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
index 56685fc03c7e..664d8c111c25 100644
--- a/tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
+++ b/tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
-
-#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c b/tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c
index ccae0b31ac6c..fbc510772bf8 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2023. Huawei Technologies Co., Ltd */
-#define _GNU_SOURCE
#include <sched.h>
#include <pthread.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c b/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c
index 2900c5e9a016..fcc045e1942d 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright 2022 Sony Group Corporation */
-#define _GNU_SOURCE
#include <fcntl.h>
#include <sys/prctl.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/test_bpffs.c b/tools/testing/selftests/bpf/prog_tests/test_bpffs.c
index ea933fd151c3..c685d13bd6f8 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_bpffs.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_bpffs.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */
-#define _GNU_SOURCE
#include <stdio.h>
#include <sched.h>
#include <sys/mount.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/test_overhead.c b/tools/testing/selftests/bpf/prog_tests/test_overhead.c
index f27013e38d03..f9d9ee8f2fa4 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_overhead.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_overhead.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2019 Facebook */
-#define _GNU_SOURCE
#include <sched.h>
#include <sys/prctl.h>
#include <test_progs.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/token.c b/tools/testing/selftests/bpf/prog_tests/token.c
index fc4a175d8d76..0b43aeda54a2 100644
--- a/tools/testing/selftests/bpf/prog_tests/token.c
+++ b/tools/testing/selftests/bpf/prog_tests/token.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
-#define _GNU_SOURCE
#include <test_progs.h>
#include <bpf/btf.h>
#include "cap_helpers.h"
diff --git a/tools/testing/selftests/bpf/prog_tests/trace_ext.c b/tools/testing/selftests/bpf/prog_tests/trace_ext.c
index aabdff7bea3e..f389bd922ef3 100644
--- a/tools/testing/selftests/bpf/prog_tests/trace_ext.c
+++ b/tools/testing/selftests/bpf/prog_tests/trace_ext.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <test_progs.h>
#include <network_helpers.h>
#include <sys/stat.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
index 6cd7349d4a2b..f21d7b7dd05e 100644
--- a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
+++ b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE
#include <test_progs.h>

struct inst {
diff --git a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
index e51721df14fc..7532139c8dbd 100644
--- a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
+++ b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
-
-#define _GNU_SOURCE
#include <linux/compiler.h>
#include <linux/ring_buffer.h>
#include <pthread.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
index 6d8b54124cb3..ca2e652a0716 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
@@ -8,8 +8,6 @@
* are correctly loaded onto the slave devices and XDP_TX'd
* packets are balanced using bonding.
*/
-
-#define _GNU_SOURCE
#include <sched.h>
#include <net/if.h>
#include <linux/if_link.h>
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c b/tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c
index 8b50a992d233..9496b576e6f5 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_synproxy.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: LGPL-2.1 OR BSD-2-Clause
/* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
-
-#define _GNU_SOURCE
#include <test_progs.h>
#include <network_helpers.h>
#include <ctype.h>
diff --git a/tools/testing/selftests/bpf/test_flow_dissector.c b/tools/testing/selftests/bpf/test_flow_dissector.c
index 571cc076dd7d..e427c7e5dd94 100644
--- a/tools/testing/selftests/bpf/test_flow_dissector.c
+++ b/tools/testing/selftests/bpf/test_flow_dissector.c
@@ -6,9 +6,6 @@
* GRE/GUE/BARE outer layer 4, where bare is IPIP/SIT/IPv4-in-IPv6/..
* IPv4/IPv6 inner layer 3
*/
-
-#define _GNU_SOURCE
-
#include <stddef.h>
#include <arpa/inet.h>
#include <asm/byteorder.h>
diff --git a/tools/testing/selftests/bpf/test_lru_map.c b/tools/testing/selftests/bpf/test_lru_map.c
index 4d0650cfb5cd..82ca6df67eab 100644
--- a/tools/testing/selftests/bpf/test_lru_map.c
+++ b/tools/testing/selftests/bpf/test_lru_map.c
@@ -2,7 +2,6 @@
/*
* Copyright (c) 2016 Facebook
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 89ff704e9dad..87b77f4f1ee5 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2017 Facebook
*/
-#define _GNU_SOURCE
#include "test_progs.h"
#include "testing_helpers.h"
#include "cgroup_helpers.h"
diff --git a/tools/testing/selftests/bpf/test_tcpnotify_user.c b/tools/testing/selftests/bpf/test_tcpnotify_user.c
index 595194453ff8..b415f6457a49 100644
--- a/tools/testing/selftests/bpf/test_tcpnotify_user.c
+++ b/tools/testing/selftests/bpf/test_tcpnotify_user.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <pthread.h>
#include <inttypes.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
index b2854238d4a0..d720947a7896 100644
--- a/tools/testing/selftests/bpf/veristat.c
+++ b/tools/testing/selftests/bpf/veristat.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
-#define _GNU_SOURCE
#include <argp.h>
#include <string.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 2eac0895b0a1..101e37a0cb1b 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -70,8 +70,6 @@
* To enable L2 - L4 headers and payload dump of each packet on STDOUT, add
* parameter -D to params array in test_xsk.sh, i.e. params=("-S" "-D")
*/
-
-#define _GNU_SOURCE
#include <assert.h>
#include <fcntl.h>
#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:03:09

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 07/68] selftests/cachestat: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/cachestat/test_cachestat.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/cachestat/test_cachestat.c b/tools/testing/selftests/cachestat/test_cachestat.c
index b171fd53b004..c1a6ce7b0912 100644
--- a/tools/testing/selftests/cachestat/test_cachestat.c
+++ b/tools/testing/selftests/cachestat/test_cachestat.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdbool.h>
#include <linux/kernel.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:03:38

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 09/68] selftests/cgroup: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/cgroup/cgroup_util.c | 3 ---
tools/testing/selftests/cgroup/test_core.c | 2 --
tools/testing/selftests/cgroup/test_cpu.c | 2 --
tools/testing/selftests/cgroup/test_hugetlb_memcg.c | 2 --
tools/testing/selftests/cgroup/test_kmem.c | 2 --
tools/testing/selftests/cgroup/test_memcontrol.c | 2 --
tools/testing/selftests/cgroup/test_zswap.c | 2 --
7 files changed, 15 deletions(-)

diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index 432db923bced..ce16a50ecff8 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -1,7 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <linux/limits.h>
diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c
index a5672a91d273..de8baad46022 100644
--- a/tools/testing/selftests/cgroup/test_core.c
+++ b/tools/testing/selftests/cgroup/test_core.c
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
-#define _GNU_SOURCE
#include <linux/limits.h>
#include <linux/sched.h>
#include <sys/types.h>
diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c
index dad2ed82f3ef..5a4a314f6af7 100644
--- a/tools/testing/selftests/cgroup/test_cpu.c
+++ b/tools/testing/selftests/cgroup/test_cpu.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <linux/limits.h>
#include <sys/sysinfo.h>
#include <sys/wait.h>
diff --git a/tools/testing/selftests/cgroup/test_hugetlb_memcg.c b/tools/testing/selftests/cgroup/test_hugetlb_memcg.c
index 856f9508ea56..80d05d50a42d 100644
--- a/tools/testing/selftests/cgroup/test_hugetlb_memcg.c
+++ b/tools/testing/selftests/cgroup/test_hugetlb_memcg.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <linux/limits.h>
#include <sys/mman.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
index 96693d8772be..2e453ac50c0d 100644
--- a/tools/testing/selftests/cgroup/test_kmem.c
+++ b/tools/testing/selftests/cgroup/test_kmem.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <linux/limits.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
index 41ae8047b889..c871630d62a3 100644
--- a/tools/testing/selftests/cgroup/test_memcontrol.c
+++ b/tools/testing/selftests/cgroup/test_memcontrol.c
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#define _GNU_SOURCE
-
#include <linux/limits.h>
#include <linux/oom.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/cgroup/test_zswap.c b/tools/testing/selftests/cgroup/test_zswap.c
index 190096017f80..cfaa94e0a175 100644
--- a/tools/testing/selftests/cgroup/test_zswap.c
+++ b/tools/testing/selftests/cgroup/test_zswap.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <linux/limits.h>
#include <unistd.h>
#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:04:20

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 11/68] selftests/core: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/core/close_range_test.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/core/close_range_test.c b/tools/testing/selftests/core/close_range_test.c
index 991c473e3859..05781c7fc578 100644
--- a/tools/testing/selftests/core/close_range_test.c
+++ b/tools/testing/selftests/core/close_range_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <linux/kernel.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:04:25

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 10/68] selftests/clone3: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/clone3/clone3.c | 2 --
tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c | 2 --
tools/testing/selftests/clone3/clone3_clear_sighand.c | 2 --
tools/testing/selftests/clone3/clone3_selftests.h | 1 -
tools/testing/selftests/clone3/clone3_set_tid.c | 2 --
5 files changed, 9 deletions(-)

diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c
index e61f07973ce5..ce2c149dab46 100644
--- a/tools/testing/selftests/clone3/clone3.c
+++ b/tools/testing/selftests/clone3/clone3.c
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0

/* Based on Christian Brauner's clone3() example */
-
-#define _GNU_SOURCE
#include <errno.h>
#include <inttypes.h>
#include <linux/types.h>
diff --git a/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c b/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c
index 31b56d625655..bb99ea20f7d5 100644
--- a/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c
+++ b/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c
@@ -7,8 +7,6 @@
*/

/* capabilities related code based on selftests/bpf/test_verifier.c */
-
-#define _GNU_SOURCE
#include <errno.h>
#include <linux/types.h>
#include <linux/sched.h>
diff --git a/tools/testing/selftests/clone3/clone3_clear_sighand.c b/tools/testing/selftests/clone3/clone3_clear_sighand.c
index ce0426786828..8ee24da7aea8 100644
--- a/tools/testing/selftests/clone3/clone3_clear_sighand.c
+++ b/tools/testing/selftests/clone3/clone3_clear_sighand.c
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
-#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
diff --git a/tools/testing/selftests/clone3/clone3_selftests.h b/tools/testing/selftests/clone3/clone3_selftests.h
index 3d2663fe50ba..172e19d5515f 100644
--- a/tools/testing/selftests/clone3/clone3_selftests.h
+++ b/tools/testing/selftests/clone3/clone3_selftests.h
@@ -3,7 +3,6 @@
#ifndef _CLONE3_SELFTESTS_H
#define _CLONE3_SELFTESTS_H

-#define _GNU_SOURCE
#include <sched.h>
#include <linux/sched.h>
#include <linux/types.h>
diff --git a/tools/testing/selftests/clone3/clone3_set_tid.c b/tools/testing/selftests/clone3/clone3_set_tid.c
index bfb0da2b4fdd..a6df528341bb 100644
--- a/tools/testing/selftests/clone3/clone3_set_tid.c
+++ b/tools/testing/selftests/clone3/clone3_set_tid.c
@@ -5,8 +5,6 @@
* These tests are assuming to be running in the host's
* PID namespace.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <linux/types.h>
#include <linux/sched.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:05:15

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 13/68] selftests/drivers: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/drivers/dma-buf/udmabuf.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
index c812080e304e..7c8dbab8ac44 100644
--- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c
+++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#define __EXPORTED_HEADERS__

#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:05:37

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 14/68] selftests/exec: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Acked-by: Kees Cook <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/exec/Makefile | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index fb4472ddffd8..c5bdb653422b 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
CFLAGS = -Wall
CFLAGS += -Wno-nonnull
-CFLAGS += -D_GNU_SOURCE

TEST_PROGS := binfmt_script.py
TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:05:57

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 06/68] selftests/breakpoints: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/breakpoints/breakpoint_test_arm64.c | 3 ---
tools/testing/selftests/breakpoints/step_after_suspend_test.c | 3 ---
2 files changed, 6 deletions(-)

diff --git a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
index e7041816085a..e5a95187ac12 100644
--- a/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
+++ b/tools/testing/selftests/breakpoints/breakpoint_test_arm64.c
@@ -7,9 +7,6 @@
* Code modified by Pratyush Anand <[email protected]>
* for testing different byte select for each access size.
*/
-
-#define _GNU_SOURCE
-
#include <asm/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
index b8703c499d28..695c10893fa4 100644
--- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c
+++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c
@@ -2,9 +2,6 @@
/*
* Copyright (C) 2016 Google, Inc.
*/
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:06:00

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 15/68] selftests/fchmodat2: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/fchmodat2/fchmodat2_test.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/fchmodat2/fchmodat2_test.c b/tools/testing/selftests/fchmodat2/fchmodat2_test.c
index e0319417124d..6b411859c2cd 100644
--- a/tools/testing/selftests/fchmodat2/fchmodat2_test.c
+++ b/tools/testing/selftests/fchmodat2/fchmodat2_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
-
-#define _GNU_SOURCE
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:06:25

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 16/68] selftests/filelock: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/filelock/ofdlocks.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/filelock/ofdlocks.c b/tools/testing/selftests/filelock/ofdlocks.c
index a55b79810ab2..301c63ddcceb 100644
--- a/tools/testing/selftests/filelock/ofdlocks.c
+++ b/tools/testing/selftests/filelock/ofdlocks.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <fcntl.h>
#include <assert.h>
#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:06:55

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 17/68] selftests/filesystems: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/filesystems/binderfs/binderfs_test.c | 2 --
tools/testing/selftests/filesystems/devpts_pts.c | 1 -
tools/testing/selftests/filesystems/dnotify_test.c | 1 -
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c | 2 --
tools/testing/selftests/filesystems/eventfd/eventfd_test.c | 2 --
tools/testing/selftests/filesystems/fat/rename_exchange.c | 2 --
tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c | 2 --
tools/testing/selftests/filesystems/statmount/statmount_test.c | 3 ---
8 files changed, 15 deletions(-)

diff --git a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
index 5f362c0fd890..fca693db1b09 100644
--- a/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
+++ b/tools/testing/selftests/filesystems/binderfs/binderfs_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
diff --git a/tools/testing/selftests/filesystems/devpts_pts.c b/tools/testing/selftests/filesystems/devpts_pts.c
index b1fc9b916ace..73766447eeb0 100644
--- a/tools/testing/selftests/filesystems/devpts_pts.c
+++ b/tools/testing/selftests/filesystems/devpts_pts.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/tools/testing/selftests/filesystems/dnotify_test.c b/tools/testing/selftests/filesystems/dnotify_test.c
index c0a9b2d3302d..05367a70b963 100644
--- a/tools/testing/selftests/filesystems/dnotify_test.c
+++ b/tools/testing/selftests/filesystems/dnotify_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE /* needed to get the defines */
#include <fcntl.h> /* in glibc 2.2 this has the needed
values defined */
#include <signal.h>
diff --git a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
index 65ede506305c..9bc2ddad7e92 100644
--- a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
+++ b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <asm/unistd.h>
#include <linux/time_types.h>
#include <poll.h>
diff --git a/tools/testing/selftests/filesystems/eventfd/eventfd_test.c b/tools/testing/selftests/filesystems/eventfd/eventfd_test.c
index f142a137526c..17935f42fbc9 100644
--- a/tools/testing/selftests/filesystems/eventfd/eventfd_test.c
+++ b/tools/testing/selftests/filesystems/eventfd/eventfd_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <asm/unistd.h>
diff --git a/tools/testing/selftests/filesystems/fat/rename_exchange.c b/tools/testing/selftests/filesystems/fat/rename_exchange.c
index e488ad354fce..56cf3ad8640d 100644
--- a/tools/testing/selftests/filesystems/fat/rename_exchange.c
+++ b/tools/testing/selftests/filesystems/fat/rename_exchange.c
@@ -6,8 +6,6 @@
* Copyright 2022 Red Hat Inc.
* Author: Javier Martinez Canillas <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
index 759f86e7d263..b58a80bde95a 100644
--- a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
+++ b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <inttypes.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
index e6d7c4f1c85b..c8944effb780 100644
--- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
+++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
-
-#define _GNU_SOURCE
-
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:07:06

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 18/68] selftests/firmware: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/firmware/fw_namespace.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/firmware/fw_namespace.c b/tools/testing/selftests/firmware/fw_namespace.c
index 04757dc7e546..c16c185753ad 100644
--- a/tools/testing/selftests/firmware/fw_namespace.c
+++ b/tools/testing/selftests/firmware/fw_namespace.c
@@ -2,7 +2,6 @@
/* Test triggering of loading of firmware from different mount
* namespaces. Expect firmware to be always loaded from the mount
* namespace of PID 1. */
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:07:28

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 08/68] selftests/capabilities: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/capabilities/test_execve.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
index 47bad7ddc5bc..7c37ae2407c6 100644
--- a/tools/testing/selftests/capabilities/test_execve.c
+++ b/tools/testing/selftests/capabilities/test_execve.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <cap-ng.h>
#include <linux/capability.h>
#include <stdbool.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:08:28

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 21/68] selftests/futex: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/futex/functional/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
index a392d0917b4e..f79f9bac7918 100644
--- a/tools/testing/selftests/futex/functional/Makefile
+++ b/tools/testing/selftests/futex/functional/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
INCLUDES := -I../include -I../../ $(KHDR_INCLUDES)
-CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES) $(KHDR_INCLUDES)
+CFLAGS := $(CFLAGS) -g -O2 -Wall -pthread $(INCLUDES) $(KHDR_INCLUDES)
LDLIBS := -lpthread -lrt

LOCAL_HDRS := \
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:08:33

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 20/68] selftests/futex: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/futex/functional/futex_requeue_pi.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi.c b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
index 7f3ca5c78df1..8e41f9fe784c 100644
--- a/tools/testing/selftests/futex/functional/futex_requeue_pi.c
+++ b/tools/testing/selftests/futex/functional/futex_requeue_pi.c
@@ -16,9 +16,6 @@
* 2009-Nov-6: futex test adaptation by Darren Hart <[email protected]>
*
*****************************************************************************/
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <limits.h>
#include <pthread.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:08:48

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 22/68] selftests/intel_pstate: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/intel_pstate/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/intel_pstate/Makefile b/tools/testing/selftests/intel_pstate/Makefile
index 05d66ef50c97..f45372cb00fe 100644
--- a/tools/testing/selftests/intel_pstate/Makefile
+++ b/tools/testing/selftests/intel_pstate/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
+CFLAGS := $(CFLAGS) -Wall
LDLIBS += -lm

ARCH ?= $(shell uname -m 2>/dev/null || echo not)
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:09:14

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 23/68] selftests/iommu: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/iommu/Makefile | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/iommu/Makefile b/tools/testing/selftests/iommu/Makefile
index 32c5fdfd0eef..fd6477911f24 100644
--- a/tools/testing/selftests/iommu/Makefile
+++ b/tools/testing/selftests/iommu/Makefile
@@ -2,8 +2,6 @@
CFLAGS += -Wall -O2 -Wno-unused-function
CFLAGS += $(KHDR_INCLUDES)

-CFLAGS += -D_GNU_SOURCE
-
TEST_GEN_PROGS :=
TEST_GEN_PROGS += iommufd
TEST_GEN_PROGS += iommufd_fail_nth
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:09:48

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 12/68] selftests/damon: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: SeongJae Park <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c | 2 --
.../damon/debugfs_target_ids_read_before_terminate_race.c | 1 -
2 files changed, 3 deletions(-)

diff --git a/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c b/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c
index 0cc2eef7d142..3f0dd30f61ef 100644
--- a/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c
+++ b/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.c
@@ -3,8 +3,6 @@
* Author: SeongJae Park <[email protected]>
*/

-#define _GNU_SOURCE
-
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c b/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c
index b06f52a8ce2d..611396076420 100644
--- a/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c
+++ b/tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c
@@ -2,7 +2,6 @@
/*
* Author: SeongJae Park <[email protected]>
*/
-#define _GNU_SOURCE

#include <fcntl.h>
#include <stdbool.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:10:15

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 25/68] selftests/kcmp: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/kcmp/kcmp_test.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
index d7a8e321bb16..f0e356139e1f 100644
--- a/tools/testing/selftests/kcmp/kcmp_test.c
+++ b/tools/testing/selftests/kcmp/kcmp_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:10:38

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 26/68] selftests/landlock: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/landlock/base_test.c | 2 --
tools/testing/selftests/landlock/fs_test.c | 2 --
tools/testing/selftests/landlock/net_test.c | 2 --
tools/testing/selftests/landlock/ptrace_test.c | 2 --
4 files changed, 8 deletions(-)

diff --git a/tools/testing/selftests/landlock/base_test.c b/tools/testing/selftests/landlock/base_test.c
index 3c1e9f35b531..c86e6f87b398 100644
--- a/tools/testing/selftests/landlock/base_test.c
+++ b/tools/testing/selftests/landlock/base_test.c
@@ -5,8 +5,6 @@
* Copyright © 2017-2020 Mickaël Salaün <[email protected]>
* Copyright © 2019-2020 ANSSI
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <linux/landlock.h>
diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
index 7d063c652be1..a30174e2e053 100644
--- a/tools/testing/selftests/landlock/fs_test.c
+++ b/tools/testing/selftests/landlock/fs_test.c
@@ -6,8 +6,6 @@
* Copyright © 2020 ANSSI
* Copyright © 2020-2022 Microsoft Corporation
*/
-
-#define _GNU_SOURCE
#include <asm/termbits.h>
#include <fcntl.h>
#include <libgen.h>
diff --git a/tools/testing/selftests/landlock/net_test.c b/tools/testing/selftests/landlock/net_test.c
index f21cfbbc3638..eed040adcbac 100644
--- a/tools/testing/selftests/landlock/net_test.c
+++ b/tools/testing/selftests/landlock/net_test.c
@@ -5,8 +5,6 @@
* Copyright © 2022-2023 Huawei Tech. Co., Ltd.
* Copyright © 2023 Microsoft Corporation
*/
-
-#define _GNU_SOURCE
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/landlock/ptrace_test.c b/tools/testing/selftests/landlock/ptrace_test.c
index a19db4d0b3bd..c831e6d03b02 100644
--- a/tools/testing/selftests/landlock/ptrace_test.c
+++ b/tools/testing/selftests/landlock/ptrace_test.c
@@ -5,8 +5,6 @@
* Copyright © 2017-2020 Mickaël Salaün <[email protected]>
* Copyright © 2019-2020 ANSSI
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <linux/landlock.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:11:02

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 27/68] selftests/lsm: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/lsm/common.c | 2 --
tools/testing/selftests/lsm/lsm_get_self_attr_test.c | 2 --
tools/testing/selftests/lsm/lsm_list_modules_test.c | 2 --
tools/testing/selftests/lsm/lsm_set_self_attr_test.c | 2 --
4 files changed, 8 deletions(-)

diff --git a/tools/testing/selftests/lsm/common.c b/tools/testing/selftests/lsm/common.c
index 9ad258912646..1b18aac570f1 100644
--- a/tools/testing/selftests/lsm/common.c
+++ b/tools/testing/selftests/lsm/common.c
@@ -4,8 +4,6 @@
*
* Copyright © 2023 Casey Schaufler <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <linux/lsm.h>
#include <fcntl.h>
#include <string.h>
diff --git a/tools/testing/selftests/lsm/lsm_get_self_attr_test.c b/tools/testing/selftests/lsm/lsm_get_self_attr_test.c
index df215e4aa63f..7465bde3f922 100644
--- a/tools/testing/selftests/lsm/lsm_get_self_attr_test.c
+++ b/tools/testing/selftests/lsm/lsm_get_self_attr_test.c
@@ -5,8 +5,6 @@
*
* Copyright © 2022 Casey Schaufler <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <linux/lsm.h>
#include <fcntl.h>
#include <string.h>
diff --git a/tools/testing/selftests/lsm/lsm_list_modules_test.c b/tools/testing/selftests/lsm/lsm_list_modules_test.c
index 06d24d4679a6..a6b44e25c21f 100644
--- a/tools/testing/selftests/lsm/lsm_list_modules_test.c
+++ b/tools/testing/selftests/lsm/lsm_list_modules_test.c
@@ -5,8 +5,6 @@
*
* Copyright © 2022 Casey Schaufler <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <linux/lsm.h>
#include <string.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
index 66dec47e3ca3..110c6a07e74c 100644
--- a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
+++ b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
@@ -5,8 +5,6 @@
*
* Copyright © 2022 Casey Schaufler <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <linux/lsm.h>
#include <string.h>
#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:11:27

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 28/68] selftests/membarrier: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/membarrier/membarrier_test_impl.h | 1 -
.../testing/selftests/membarrier/membarrier_test_multi_thread.c | 1 -
.../testing/selftests/membarrier/membarrier_test_single_thread.c | 1 -
3 files changed, 3 deletions(-)

diff --git a/tools/testing/selftests/membarrier/membarrier_test_impl.h b/tools/testing/selftests/membarrier/membarrier_test_impl.h
index af89855adb7b..a8a60b6271a5 100644
--- a/tools/testing/selftests/membarrier/membarrier_test_impl.h
+++ b/tools/testing/selftests/membarrier/membarrier_test_impl.h
@@ -1,5 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#define _GNU_SOURCE
#include <linux/membarrier.h>
#include <syscall.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c b/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c
index 4e14dba81234..c00f380b2757 100644
--- a/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c
+++ b/tools/testing/selftests/membarrier/membarrier_test_multi_thread.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <linux/membarrier.h>
#include <syscall.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/membarrier/membarrier_test_single_thread.c b/tools/testing/selftests/membarrier/membarrier_test_single_thread.c
index fa3f1d6c37a0..c399fbad8efd 100644
--- a/tools/testing/selftests/membarrier/membarrier_test_single_thread.c
+++ b/tools/testing/selftests/membarrier/membarrier_test_single_thread.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <linux/membarrier.h>
#include <syscall.h>
#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:11:45

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 29/68] selftests/memfd: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/memfd/common.c | 1 -
tools/testing/selftests/memfd/fuse_test.c | 2 --
tools/testing/selftests/memfd/memfd_test.c | 1 -
3 files changed, 4 deletions(-)

diff --git a/tools/testing/selftests/memfd/common.c b/tools/testing/selftests/memfd/common.c
index 8eb3d75f6e60..879d4f4c66fa 100644
--- a/tools/testing/selftests/memfd/common.c
+++ b/tools/testing/selftests/memfd/common.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#define __EXPORTED_HEADERS__

#include <stdio.h>
diff --git a/tools/testing/selftests/memfd/fuse_test.c b/tools/testing/selftests/memfd/fuse_test.c
index dbc171a3806d..e35c6909f0bb 100644
--- a/tools/testing/selftests/memfd/fuse_test.c
+++ b/tools/testing/selftests/memfd/fuse_test.c
@@ -12,8 +12,6 @@
* the read() syscall with our memory-mapped memfd object as receive buffer to
* force the kernel to write into our memfd object.
*/
-
-#define _GNU_SOURCE
#define __EXPORTED_HEADERS__

#include <errno.h>
diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 95af2d78fd31..ee019b57bb98 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#define __EXPORTED_HEADERS__

#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:12:06

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 30/68] selftests/mincore: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/mincore/mincore_selftest.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/tools/testing/selftests/mincore/mincore_selftest.c b/tools/testing/selftests/mincore/mincore_selftest.c
index e949a43a6145..e12398366523 100644
--- a/tools/testing/selftests/mincore/mincore_selftest.c
+++ b/tools/testing/selftests/mincore/mincore_selftest.c
@@ -4,9 +4,6 @@
*
* Copyright (C) 2020 Collabora, Ltd.
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:13:25

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 33/68] selftests/mount_setattr: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/mount_setattr/mount_setattr_test.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/mount_setattr/mount_setattr_test.c b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
index c6a8c732b802..d894417134b6 100644
--- a/tools/testing/selftests/mount_setattr/mount_setattr_test.c
+++ b/tools/testing/selftests/mount_setattr/mount_setattr_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:14:08

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 35/68] selftests/mqueue: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/mqueue/mq_perf_tests.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
index 5c16159d0bcd..7be29c3bfed4 100644
--- a/tools/testing/selftests/mqueue/mq_perf_tests.c
+++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
@@ -20,7 +20,6 @@
* performance.
*
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:14:50

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 36/68] selftests/net: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/net/af_unix/diag_uid.c | 2 --
tools/testing/selftests/net/af_unix/scm_pidfd.c | 1 -
tools/testing/selftests/net/af_unix/scm_rights.c | 1 -
tools/testing/selftests/net/af_unix/unix_connect.c | 2 --
tools/testing/selftests/net/epoll_busy_poll.c | 2 --
tools/testing/selftests/net/gro.c | 3 ---
tools/testing/selftests/net/ip_defrag.c | 3 ---
tools/testing/selftests/net/ipsec.c | 3 ---
tools/testing/selftests/net/ipv6_flowlabel.c | 3 ---
tools/testing/selftests/net/ipv6_flowlabel_mgr.c | 3 ---
tools/testing/selftests/net/lib/csum.c | 3 ---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 3 ---
tools/testing/selftests/net/mptcp/mptcp_inq.c | 3 ---
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 3 ---
tools/testing/selftests/net/msg_zerocopy.c | 3 ---
tools/testing/selftests/net/netfilter/audit_logread.c | 2 --
tools/testing/selftests/net/netfilter/conntrack_dump_flush.c | 3 ---
tools/testing/selftests/net/nettest.c | 2 --
tools/testing/selftests/net/psock_fanout.c | 3 ---
tools/testing/selftests/net/psock_snd.c | 3 ---
tools/testing/selftests/net/reuseport_addr_any.c | 3 ---
tools/testing/selftests/net/reuseport_bpf_cpu.c | 3 ---
tools/testing/selftests/net/reuseport_bpf_numa.c | 3 ---
tools/testing/selftests/net/reuseport_dualstack.c | 3 ---
tools/testing/selftests/net/so_incoming_cpu.c | 1 -
tools/testing/selftests/net/so_netns_cookie.c | 1 -
tools/testing/selftests/net/so_txtime.c | 3 ---
tools/testing/selftests/net/tap.c | 3 ---
tools/testing/selftests/net/tcp_fastopen_backup_key.c | 1 -
tools/testing/selftests/net/tcp_inq.c | 2 --
tools/testing/selftests/net/tcp_mmap.c | 1 -
tools/testing/selftests/net/tls.c | 3 ---
tools/testing/selftests/net/toeplitz.c | 3 ---
tools/testing/selftests/net/tun.c | 3 ---
tools/testing/selftests/net/txring_overwrite.c | 3 ---
tools/testing/selftests/net/txtimestamp.c | 3 ---
tools/testing/selftests/net/udpgso.c | 3 ---
tools/testing/selftests/net/udpgso_bench_rx.c | 3 ---
tools/testing/selftests/net/udpgso_bench_tx.c | 3 ---
39 files changed, 99 deletions(-)

diff --git a/tools/testing/selftests/net/af_unix/diag_uid.c b/tools/testing/selftests/net/af_unix/diag_uid.c
index 79a3dd75590e..279d0c5f70d3 100644
--- a/tools/testing/selftests/net/af_unix/diag_uid.c
+++ b/tools/testing/selftests/net/af_unix/diag_uid.c
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright Amazon.com Inc. or its affiliates. */
-
-#define _GNU_SOURCE
#include <sched.h>

#include <unistd.h>
diff --git a/tools/testing/selftests/net/af_unix/scm_pidfd.c b/tools/testing/selftests/net/af_unix/scm_pidfd.c
index 7e534594167e..2986b8cd0418 100644
--- a/tools/testing/selftests/net/af_unix/scm_pidfd.c
+++ b/tools/testing/selftests/net/af_unix/scm_pidfd.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0 OR MIT
-#define _GNU_SOURCE
#include <error.h>
#include <limits.h>
#include <stddef.h>
diff --git a/tools/testing/selftests/net/af_unix/scm_rights.c b/tools/testing/selftests/net/af_unix/scm_rights.c
index bab606c9f1eb..146a8d7a8cd9 100644
--- a/tools/testing/selftests/net/af_unix/scm_rights.c
+++ b/tools/testing/selftests/net/af_unix/scm_rights.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright Amazon.com Inc. or its affiliates. */
-#define _GNU_SOURCE
#include <sched.h>

#include <stdio.h>
diff --git a/tools/testing/selftests/net/af_unix/unix_connect.c b/tools/testing/selftests/net/af_unix/unix_connect.c
index d799fd8f5c7c..34e816862cc7 100644
--- a/tools/testing/selftests/net/af_unix/unix_connect.c
+++ b/tools/testing/selftests/net/af_unix/unix_connect.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <sched.h>

#include <stddef.h>
diff --git a/tools/testing/selftests/net/epoll_busy_poll.c b/tools/testing/selftests/net/epoll_busy_poll.c
index 16e457c2f877..d3b8cab36fb5 100644
--- a/tools/testing/selftests/net/epoll_busy_poll.c
+++ b/tools/testing/selftests/net/epoll_busy_poll.c
@@ -6,8 +6,6 @@
* the future
*/

-#define _GNU_SOURCE
-
#include <error.h>
#include <errno.h>
#include <inttypes.h>
diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c
index b2184847e388..2ce3c0d2e8b9 100644
--- a/tools/testing/selftests/net/gro.c
+++ b/tools/testing/selftests/net/gro.c
@@ -34,9 +34,6 @@
* flakiness is to be expected.
*
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/ip_defrag.c b/tools/testing/selftests/net/ip_defrag.c
index f9ed749fd8c7..80c9e567a3d8 100644
--- a/tools/testing/selftests/net/ip_defrag.c
+++ b/tools/testing/selftests/net/ip_defrag.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/ipsec.c b/tools/testing/selftests/net/ipsec.c
index be4a30a0d02a..04aa06d26b09 100644
--- a/tools/testing/selftests/net/ipsec.c
+++ b/tools/testing/selftests/net/ipsec.c
@@ -3,9 +3,6 @@
* ipsec.c - Check xfrm on veth inside a net-ns.
* Copyright (c) 2018 Dmitry Safonov
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <asm/types.h>
#include <errno.h>
diff --git a/tools/testing/selftests/net/ipv6_flowlabel.c b/tools/testing/selftests/net/ipv6_flowlabel.c
index 708a9822259d..b7e0c3c02e20 100644
--- a/tools/testing/selftests/net/ipv6_flowlabel.c
+++ b/tools/testing/selftests/net/ipv6_flowlabel.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Test IPV6_FLOWINFO cmsg on send and recv */
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <asm/byteorder.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/ipv6_flowlabel_mgr.c b/tools/testing/selftests/net/ipv6_flowlabel_mgr.c
index af95b48acea9..ebd219ba386e 100644
--- a/tools/testing/selftests/net/ipv6_flowlabel_mgr.c
+++ b/tools/testing/selftests/net/ipv6_flowlabel_mgr.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Test IPV6_FLOWINFO_MGR */
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <error.h>
#include <errno.h>
diff --git a/tools/testing/selftests/net/lib/csum.c b/tools/testing/selftests/net/lib/csum.c
index b9f3fc3c3426..28f8241b8567 100644
--- a/tools/testing/selftests/net/lib/csum.c
+++ b/tools/testing/selftests/net/lib/csum.c
@@ -58,9 +58,6 @@
* different seed for each run (and logs this for reproducibility). It
* is advised to enable this for extra coverage in continuous testing.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <asm/byteorder.h>
#include <errno.h>
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index d2043ec3bf6d..ea93030ed3ec 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/net/mptcp/mptcp_inq.c b/tools/testing/selftests/net/mptcp/mptcp_inq.c
index 218aac467321..c5bf873d76c2 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_inq.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_inq.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index 926b0be87c99..7203ca9900e9 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c
index bdc03a2097e8..9278bf585c80 100644
--- a/tools/testing/selftests/net/msg_zerocopy.c
+++ b/tools/testing/selftests/net/msg_zerocopy.c
@@ -24,9 +24,6 @@
* the kernel queues completions on the error queue for all zerocopy
* transfers.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <error.h>
#include <errno.h>
diff --git a/tools/testing/selftests/net/netfilter/audit_logread.c b/tools/testing/selftests/net/netfilter/audit_logread.c
index a0a880fc2d9d..0b3dddab1c52 100644
--- a/tools/testing/selftests/net/netfilter/audit_logread.c
+++ b/tools/testing/selftests/net/netfilter/audit_logread.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
diff --git a/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c b/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
index bd9317bf5ada..fb6c5d1b6f63 100644
--- a/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
+++ b/tools/testing/selftests/net/netfilter/conntrack_dump_flush.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <time.h>
#include <libmnl/libmnl.h>
#include <netinet/ip.h>
diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c
index cd8a58097448..88e1d3b2ddf1 100644
--- a/tools/testing/selftests/net/nettest.c
+++ b/tools/testing/selftests/net/nettest.c
@@ -3,8 +3,6 @@
*
* Copyright (c) 2013-2019 David Ahern <[email protected]>. All rights reserved.
*/
-
-#define _GNU_SOURCE
#include <features.h>
#include <sys/types.h>
#include <sys/ioctl.h>
diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c
index 1a736f700be4..5b2d34440ae9 100644
--- a/tools/testing/selftests/net/psock_fanout.c
+++ b/tools/testing/selftests/net/psock_fanout.c
@@ -26,9 +26,6 @@
* Todo:
* - functionality: PACKET_FANOUT_FLAG_DEFRAG
*/
-
-#define _GNU_SOURCE /* for sched_setaffinity */
-
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/net/psock_snd.c b/tools/testing/selftests/net/psock_snd.c
index edf1e6f80d41..2f29b513e18f 100644
--- a/tools/testing/selftests/net/psock_snd.c
+++ b/tools/testing/selftests/net/psock_snd.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/reuseport_addr_any.c b/tools/testing/selftests/net/reuseport_addr_any.c
index b8475cb29be7..9ee6ece52865 100644
--- a/tools/testing/selftests/net/reuseport_addr_any.c
+++ b/tools/testing/selftests/net/reuseport_addr_any.c
@@ -3,9 +3,6 @@
/* Test that sockets listening on a specific address are preferred
* over sockets listening on addr_any.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/reuseport_bpf_cpu.c b/tools/testing/selftests/net/reuseport_bpf_cpu.c
index 2d646174729f..e93e38cfb2a8 100644
--- a/tools/testing/selftests/net/reuseport_bpf_cpu.c
+++ b/tools/testing/selftests/net/reuseport_bpf_cpu.c
@@ -11,9 +11,6 @@
* This entire process is done for several different core id permutations
* and for each IPv4/IPv6 and TCP/UDP combination.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index c9ba36aa688e..502fdb9ce770 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -3,9 +3,6 @@
* Test functionality of BPF filters with SO_REUSEPORT. Same test as
* in reuseport_bpf_cpu, only as one socket per NUMA node.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/reuseport_dualstack.c b/tools/testing/selftests/net/reuseport_dualstack.c
index fb7a59ed759e..d3c3d3f39f8f 100644
--- a/tools/testing/selftests/net/reuseport_dualstack.c
+++ b/tools/testing/selftests/net/reuseport_dualstack.c
@@ -10,9 +10,6 @@
* This test creates these mixed AF_INET/AF_INET6 sockets and asserts the
* AF_INET preference for v4 packets.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/so_incoming_cpu.c b/tools/testing/selftests/net/so_incoming_cpu.c
index e9fa14e10732..95bd0cdc3253 100644
--- a/tools/testing/selftests/net/so_incoming_cpu.c
+++ b/tools/testing/selftests/net/so_incoming_cpu.c
@@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright Amazon.com Inc. or its affiliates. */
-#define _GNU_SOURCE
#include <sched.h>

#include <fcntl.h>
diff --git a/tools/testing/selftests/net/so_netns_cookie.c b/tools/testing/selftests/net/so_netns_cookie.c
index b39e87e967cd..18532d564f79 100644
--- a/tools/testing/selftests/net/so_netns_cookie.c
+++ b/tools/testing/selftests/net/so_netns_cookie.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/net/so_txtime.c b/tools/testing/selftests/net/so_txtime.c
index 8457b7ccbc09..011a24af9786 100644
--- a/tools/testing/selftests/net/so_txtime.c
+++ b/tools/testing/selftests/net/so_txtime.c
@@ -9,9 +9,6 @@
* the expected stream. Sender will read transmit timestamps from the error
* queue. The streams can differ due to out-of-order delivery and drops.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <error.h>
#include <errno.h>
diff --git a/tools/testing/selftests/net/tap.c b/tools/testing/selftests/net/tap.c
index 247c3b3ac1c9..fa78b92d9740 100644
--- a/tools/testing/selftests/net/tap.c
+++ b/tools/testing/selftests/net/tap.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/net/tcp_fastopen_backup_key.c b/tools/testing/selftests/net/tcp_fastopen_backup_key.c
index c1cb0c75156a..d30f89bb944c 100644
--- a/tools/testing/selftests/net/tcp_fastopen_backup_key.c
+++ b/tools/testing/selftests/net/tcp_fastopen_backup_key.c
@@ -12,7 +12,6 @@
* there are no cases in which a cookie is not accepted by verifying
* that TcpExtTCPFastOpenPassiveFail remains 0.
*/
-#define _GNU_SOURCE
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/tcp_inq.c b/tools/testing/selftests/net/tcp_inq.c
index bd6a9c7a3e8a..71ee145f151e 100644
--- a/tools/testing/selftests/net/tcp_inq.c
+++ b/tools/testing/selftests/net/tcp_inq.c
@@ -5,8 +5,6 @@
*
* Simple example on how to use TCP_INQ and TCP_CM_INQ.
*/
-#define _GNU_SOURCE
-
#include <error.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 4fcce5150850..72d5f1207ee0 100644
--- a/tools/testing/selftests/net/tcp_mmap.c
+++ b/tools/testing/selftests/net/tcp_mmap.c
@@ -46,7 +46,6 @@
* received 32768 MB (99.9939 % mmap'ed) in 7.43764 s, 36.9577 Gbit
* cpu usage user:0.035 sys:3.467, 106.873 usec per MB, 65530 c-switches
*/
-#define _GNU_SOURCE
#include <pthread.h>
#include <sys/types.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index f27a12d2a2c9..6dbad97d1d0a 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/toeplitz.c b/tools/testing/selftests/net/toeplitz.c
index 9ba03164d73a..e2d739892ce4 100644
--- a/tools/testing/selftests/net/toeplitz.c
+++ b/tools/testing/selftests/net/toeplitz.c
@@ -20,9 +20,6 @@
* 5. Compute the cpu that RPS should select based on rx_hash and $rps_bitmap
* 6. Compare the cpus from 4 and 5
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/tun.c b/tools/testing/selftests/net/tun.c
index fa83918b62d1..a64dcfb242c1 100644
--- a/tools/testing/selftests/net/tun.c
+++ b/tools/testing/selftests/net/tun.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/net/txring_overwrite.c b/tools/testing/selftests/net/txring_overwrite.c
index 7d9ea039450a..96972e0110a0 100644
--- a/tools/testing/selftests/net/txring_overwrite.c
+++ b/tools/testing/selftests/net/txring_overwrite.c
@@ -4,9 +4,6 @@
* Verify that consecutive sends over packet tx_ring are mirrored
* with their original content intact.
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <assert.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/txtimestamp.c b/tools/testing/selftests/net/txtimestamp.c
index ec60a16c9307..33dba9e90dea 100644
--- a/tools/testing/selftests/net/txtimestamp.c
+++ b/tools/testing/selftests/net/txtimestamp.c
@@ -16,9 +16,6 @@
* This test requires a dummy TCP server.
* A simple `nc6 [-u] -l -p $DESTPORT` will do
*/
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <asm/types.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c
index 85b3baa3f7f3..9dc1026a033a 100644
--- a/tools/testing/selftests/net/udpgso.c
+++ b/tools/testing/selftests/net/udpgso.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <stddef.h>
#include <arpa/inet.h>
#include <error.h>
diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c
index 1cbadd267c96..999df1236320 100644
--- a/tools/testing/selftests/net/udpgso_bench_rx.c
+++ b/tools/testing/selftests/net/udpgso_bench_rx.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <error.h>
#include <errno.h>
diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
index 477392715a9a..d7632993b354 100644
--- a/tools/testing/selftests/net/udpgso_bench_tx.c
+++ b/tools/testing/selftests/net/udpgso_bench_tx.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <arpa/inet.h>
#include <errno.h>
#include <error.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:15:14

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 38/68] selftests/nsfs: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/nsfs/owner.c | 1 -
tools/testing/selftests/nsfs/pidns.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/tools/testing/selftests/nsfs/owner.c b/tools/testing/selftests/nsfs/owner.c
index 96a976c74550..975834ef42aa 100644
--- a/tools/testing/selftests/nsfs/owner.c
+++ b/tools/testing/selftests/nsfs/owner.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/nsfs/pidns.c b/tools/testing/selftests/nsfs/pidns.c
index e3c772c6a7c7..9136fcaf3f40 100644
--- a/tools/testing/selftests/nsfs/pidns.c
+++ b/tools/testing/selftests/nsfs/pidns.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:16:00

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 40/68] selftests/perf_events: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/perf_events/remove_on_exec.c | 2 --
tools/testing/selftests/perf_events/sigtrap_threads.c | 2 --
tools/testing/selftests/perf_events/watermark_signal.c | 2 --
3 files changed, 6 deletions(-)

diff --git a/tools/testing/selftests/perf_events/remove_on_exec.c b/tools/testing/selftests/perf_events/remove_on_exec.c
index 5814611a1dc7..ef4d923f4759 100644
--- a/tools/testing/selftests/perf_events/remove_on_exec.c
+++ b/tools/testing/selftests/perf_events/remove_on_exec.c
@@ -5,8 +5,6 @@
* Copyright (C) 2021, Google LLC.
*/

-#define _GNU_SOURCE
-
/* We need the latest siginfo from the kernel repo. */
#include <sys/types.h>
#include <asm/siginfo.h>
diff --git a/tools/testing/selftests/perf_events/sigtrap_threads.c b/tools/testing/selftests/perf_events/sigtrap_threads.c
index d1d8483ac628..14d1a3c8cb5c 100644
--- a/tools/testing/selftests/perf_events/sigtrap_threads.c
+++ b/tools/testing/selftests/perf_events/sigtrap_threads.c
@@ -5,8 +5,6 @@
* Copyright (C) 2021, Google LLC.
*/

-#define _GNU_SOURCE
-
/* We need the latest siginfo from the kernel repo. */
#include <sys/types.h>
#include <asm/siginfo.h>
diff --git a/tools/testing/selftests/perf_events/watermark_signal.c b/tools/testing/selftests/perf_events/watermark_signal.c
index 49dc1e831174..19557bd16e9e 100644
--- a/tools/testing/selftests/perf_events/watermark_signal.c
+++ b/tools/testing/selftests/perf_events/watermark_signal.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <linux/perf_event.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:16:15

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 19/68] selftests/fpu: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/fpu/test_fpu.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/fpu/test_fpu.c b/tools/testing/selftests/fpu/test_fpu.c
index 200238522a9d..53a7fef839e7 100644
--- a/tools/testing/selftests/fpu/test_fpu.c
+++ b/tools/testing/selftests/fpu/test_fpu.c
@@ -4,8 +4,6 @@
* module to perform floating point operations in the kernel. The control
* register value should be independent between kernel and user mode.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <string.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:16:54

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 42/68] selftests/pidfd: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/pidfd/pidfd.h | 1 -
tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_getfd_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_open_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_poll_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_setns_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_test.c | 2 --
tools/testing/selftests/pidfd/pidfd_wait.c | 2 --
8 files changed, 15 deletions(-)

diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h
index 88d6830ee004..e33177b1aa41 100644
--- a/tools/testing/selftests/pidfd/pidfd.h
+++ b/tools/testing/selftests/pidfd/pidfd.h
@@ -3,7 +3,6 @@
#ifndef __PIDFD_H
#define __PIDFD_H

-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
index f062a986e382..84135d75ece7 100644
--- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_getfd_test.c b/tools/testing/selftests/pidfd/pidfd_getfd_test.c
index cd51d547b751..b6a0e9b3d2f5 100644
--- a/tools/testing/selftests/pidfd/pidfd_getfd_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_getfd_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_open_test.c b/tools/testing/selftests/pidfd/pidfd_open_test.c
index c62564c264b1..f6735eca1dab 100644
--- a/tools/testing/selftests/pidfd/pidfd_open_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_open_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_poll_test.c b/tools/testing/selftests/pidfd/pidfd_poll_test.c
index 55d74a50358f..83af8489c88e 100644
--- a/tools/testing/selftests/pidfd/pidfd_poll_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_poll_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <linux/types.h>
#include <poll.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_setns_test.c b/tools/testing/selftests/pidfd/pidfd_setns_test.c
index 47746b0c6acd..518051f0c3a1 100644
--- a/tools/testing/selftests/pidfd/pidfd_setns_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_setns_test.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c
index 9faa686f90e4..53cce08a2202 100644
--- a/tools/testing/selftests/pidfd/pidfd_test.c
+++ b/tools/testing/selftests/pidfd/pidfd_test.c
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <linux/types.h>
diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c
index 0dcb8365ddc3..54beba0983f1 100644
--- a/tools/testing/selftests/pidfd/pidfd_wait.c
+++ b/tools/testing/selftests/pidfd/pidfd_wait.c
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
-#define _GNU_SOURCE
#include <errno.h>
#include <linux/sched.h>
#include <linux/types.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:17:13

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 43/68] selftests/ptrace: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/ptrace/get_set_sud.c | 1 -
tools/testing/selftests/ptrace/peeksiginfo.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/tools/testing/selftests/ptrace/get_set_sud.c b/tools/testing/selftests/ptrace/get_set_sud.c
index 5297b10d25c3..054a78ebe8b5 100644
--- a/tools/testing/selftests/ptrace/get_set_sud.c
+++ b/tools/testing/selftests/ptrace/get_set_sud.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include "../kselftest_harness.h"
#include <stdio.h>
#include <string.h>
diff --git a/tools/testing/selftests/ptrace/peeksiginfo.c b/tools/testing/selftests/ptrace/peeksiginfo.c
index a6884f66dc01..1b7b77190f72 100644
--- a/tools/testing/selftests/ptrace/peeksiginfo.c
+++ b/tools/testing/selftests/ptrace/peeksiginfo.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:17:25

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 39/68] selftests/openat2: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/openat2/helpers.c | 2 --
tools/testing/selftests/openat2/helpers.h | 1 -
tools/testing/selftests/openat2/openat2_test.c | 2 --
tools/testing/selftests/openat2/rename_attack_test.c | 2 --
tools/testing/selftests/openat2/resolve_test.c | 2 --
5 files changed, 9 deletions(-)

diff --git a/tools/testing/selftests/openat2/helpers.c b/tools/testing/selftests/openat2/helpers.c
index 5074681ffdc9..3658722c889c 100644
--- a/tools/testing/selftests/openat2/helpers.c
+++ b/tools/testing/selftests/openat2/helpers.c
@@ -3,8 +3,6 @@
* Author: Aleksa Sarai <[email protected]>
* Copyright (C) 2018-2019 SUSE LLC.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/openat2/helpers.h b/tools/testing/selftests/openat2/helpers.h
index 7056340b9339..ecd20a3d47ee 100644
--- a/tools/testing/selftests/openat2/helpers.h
+++ b/tools/testing/selftests/openat2/helpers.h
@@ -7,7 +7,6 @@
#ifndef __RESOLVEAT_H__
#define __RESOLVEAT_H__

-#define _GNU_SOURCE
#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c
index 9024754530b2..51f1a7d16cc9 100644
--- a/tools/testing/selftests/openat2/openat2_test.c
+++ b/tools/testing/selftests/openat2/openat2_test.c
@@ -3,8 +3,6 @@
* Author: Aleksa Sarai <[email protected]>
* Copyright (C) 2018-2019 SUSE LLC.
*/
-
-#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <sys/stat.h>
diff --git a/tools/testing/selftests/openat2/rename_attack_test.c b/tools/testing/selftests/openat2/rename_attack_test.c
index 0a770728b436..477125eb64e2 100644
--- a/tools/testing/selftests/openat2/rename_attack_test.c
+++ b/tools/testing/selftests/openat2/rename_attack_test.c
@@ -3,8 +3,6 @@
* Author: Aleksa Sarai <[email protected]>
* Copyright (C) 2018-2019 SUSE LLC.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/tools/testing/selftests/openat2/resolve_test.c b/tools/testing/selftests/openat2/resolve_test.c
index bbafad440893..48fa772de13e 100644
--- a/tools/testing/selftests/openat2/resolve_test.c
+++ b/tools/testing/selftests/openat2/resolve_test.c
@@ -3,8 +3,6 @@
* Author: Aleksa Sarai <[email protected]>
* Copyright (C) 2018-2019 SUSE LLC.
*/
-
-#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <sys/stat.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:19:05

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 45/68] selftests/proc: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/proc/proc-empty-vm.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c
index 56198d4ca2bf..f92a8dce58cf 100644
--- a/tools/testing/selftests/proc/proc-empty-vm.c
+++ b/tools/testing/selftests/proc/proc-empty-vm.c
@@ -23,9 +23,6 @@
* /proc/${pid}/smaps
* /proc/${pid}/smaps_rollup
*/
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
-
#undef NDEBUG
#include <assert.h>
#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:19:09

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 24/68] selftests/ipc: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/ipc/msgque.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index c75ea4094870..45aba6aa8e1d 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:19:33

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 47/68] selftests/ptp: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/ptp/testptp.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c
index 011252fe238c..ea3c48b97468 100644
--- a/tools/testing/selftests/ptp/testptp.c
+++ b/tools/testing/selftests/ptp/testptp.c
@@ -4,7 +4,6 @@
*
* Copyright (C) 2010 OMICRON electronics GmbH
*/
-#define _GNU_SOURCE
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
#include <errno.h>
#include <fcntl.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:19:36

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 48/68] selftests/resctrl: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Acked-by: Reinette Chatre <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/resctrl/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/resctrl/Makefile b/tools/testing/selftests/resctrl/Makefile
index 021863f86053..f408bd6bfc3d 100644
--- a/tools/testing/selftests/resctrl/Makefile
+++ b/tools/testing/selftests/resctrl/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0

-CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
+CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2
CFLAGS += $(KHDR_INCLUDES)

TEST_GEN_PROGS := resctrl_tests
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:19:43

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 49/68] selftests/riscv: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/riscv/hwprobe/cbo.c | 1 -
tools/testing/selftests/riscv/hwprobe/which-cpus.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c
index a40541bb7c7d..4de6f63fc537 100644
--- a/tools/testing/selftests/riscv/hwprobe/cbo.c
+++ b/tools/testing/selftests/riscv/hwprobe/cbo.c
@@ -5,7 +5,6 @@
* Run with 'taskset -c <cpu-list> cbo' to only execute hwprobe on a
* subset of cpus, as well as only executing the tests on those cpus.
*/
-#define _GNU_SOURCE
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
diff --git a/tools/testing/selftests/riscv/hwprobe/which-cpus.c b/tools/testing/selftests/riscv/hwprobe/which-cpus.c
index 82c121412dfc..c3f080861c06 100644
--- a/tools/testing/selftests/riscv/hwprobe/which-cpus.c
+++ b/tools/testing/selftests/riscv/hwprobe/which-cpus.c
@@ -5,7 +5,6 @@
* Test the RISCV_HWPROBE_WHICH_CPUS flag of hwprobe. Also provides a command
* line interface to get the cpu list for arbitrary hwprobe pairs.
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:20:00

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 50/68] selftests/riscv: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/riscv/mm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/riscv/mm/Makefile b/tools/testing/selftests/riscv/mm/Makefile
index c333263f2b27..4664ed79e20b 100644
--- a/tools/testing/selftests/riscv/mm/Makefile
+++ b/tools/testing/selftests/riscv/mm/Makefile
@@ -3,7 +3,7 @@
# Originally tools/testing/arm64/abi/Makefile

# Additional include paths needed by kselftest.h and local headers
-CFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
+CFLAGS += -std=gnu99 -I.

TEST_GEN_FILES := mmap_default mmap_bottomup

--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:20:22

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 51/68] selftests/rlimits: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/rlimits/rlimits-per-userns.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/rlimits/rlimits-per-userns.c b/tools/testing/selftests/rlimits/rlimits-per-userns.c
index 26dc949e93ea..e0b4f2af9cee 100644
--- a/tools/testing/selftests/rlimits/rlimits-per-userns.c
+++ b/tools/testing/selftests/rlimits/rlimits-per-userns.c
@@ -2,7 +2,6 @@
/*
* Author: Alexey Gladkov <[email protected]>
*/
-#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:22:00

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 52/68] selftests/rseq: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/rseq/basic_percpu_ops_test.c | 1 -
tools/testing/selftests/rseq/basic_test.c | 2 --
tools/testing/selftests/rseq/param_test.c | 1 -
tools/testing/selftests/rseq/rseq.c | 2 --
4 files changed, 6 deletions(-)

diff --git a/tools/testing/selftests/rseq/basic_percpu_ops_test.c b/tools/testing/selftests/rseq/basic_percpu_ops_test.c
index 2348d2c20d0a..5961c24ee1ae 100644
--- a/tools/testing/selftests/rseq/basic_percpu_ops_test.c
+++ b/tools/testing/selftests/rseq/basic_percpu_ops_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: LGPL-2.1
-#define _GNU_SOURCE
#include <assert.h>
#include <pthread.h>
#include <sched.h>
diff --git a/tools/testing/selftests/rseq/basic_test.c b/tools/testing/selftests/rseq/basic_test.c
index 295eea16466f..1fed749b4bd7 100644
--- a/tools/testing/selftests/rseq/basic_test.c
+++ b/tools/testing/selftests/rseq/basic_test.c
@@ -2,8 +2,6 @@
/*
* Basic test coverage for critical regions and rseq_current_cpu().
*/
-
-#define _GNU_SOURCE
#include <assert.h>
#include <sched.h>
#include <signal.h>
diff --git a/tools/testing/selftests/rseq/param_test.c b/tools/testing/selftests/rseq/param_test.c
index 2f37961240ca..48a55d94eb72 100644
--- a/tools/testing/selftests/rseq/param_test.c
+++ b/tools/testing/selftests/rseq/param_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: LGPL-2.1
-#define _GNU_SOURCE
#include <assert.h>
#include <linux/membarrier.h>
#include <pthread.h>
diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c
index 96e812bdf8a4..88602889414c 100644
--- a/tools/testing/selftests/rseq/rseq.c
+++ b/tools/testing/selftests/rseq/rseq.c
@@ -14,8 +14,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <stdio.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:22:15

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 53/68] selftests/safesetid: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/safesetid/safesetid-test.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/safesetid/safesetid-test.c b/tools/testing/selftests/safesetid/safesetid-test.c
index eb9bf0aee951..89b9d83b76f6 100644
--- a/tools/testing/selftests/safesetid/safesetid-test.c
+++ b/tools/testing/selftests/safesetid/safesetid-test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <pwd.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:22:24

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 54/68] selftests/sched: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/sched/cs_prctl_test.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/sched/cs_prctl_test.c b/tools/testing/selftests/sched/cs_prctl_test.c
index 62fba7356af2..abf907f243b6 100644
--- a/tools/testing/selftests/sched/cs_prctl_test.c
+++ b/tools/testing/selftests/sched/cs_prctl_test.c
@@ -18,8 +18,6 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, see <http://www.gnu.org/licenses>.
*/
-
-#define _GNU_SOURCE
#include <sys/eventfd.h>
#include <sys/wait.h>
#include <sys/types.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:22:39

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 31/68] selftests/mm: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/mm/cow.c | 1 -
tools/testing/selftests/mm/gup_longterm.c | 1 -
tools/testing/selftests/mm/hugepage-mmap.c | 1 -
tools/testing/selftests/mm/hugepage-mremap.c | 2 --
tools/testing/selftests/mm/hugetlb-madvise.c | 2 --
tools/testing/selftests/mm/hugetlb-read-hwpoison.c | 2 --
tools/testing/selftests/mm/khugepaged.c | 1 -
tools/testing/selftests/mm/ksm_functional_tests.c | 1 -
tools/testing/selftests/mm/madv_populate.c | 1 -
tools/testing/selftests/mm/map_populate.c | 2 --
tools/testing/selftests/mm/memfd_secret.c | 2 --
tools/testing/selftests/mm/mlock2-tests.c | 1 -
tools/testing/selftests/mm/mrelease_test.c | 1 -
tools/testing/selftests/mm/mremap_dontunmap.c | 1 -
tools/testing/selftests/mm/mremap_test.c | 2 --
tools/testing/selftests/mm/mseal_test.c | 1 -
tools/testing/selftests/mm/pagemap_ioctl.c | 1 -
tools/testing/selftests/mm/pkey-helpers.h | 1 -
tools/testing/selftests/mm/protection_keys.c | 1 -
tools/testing/selftests/mm/seal_elf.c | 1 -
tools/testing/selftests/mm/split_huge_page_test.c | 2 --
tools/testing/selftests/mm/thuge-gen.c | 2 --
tools/testing/selftests/mm/uffd-common.h | 1 -
23 files changed, 31 deletions(-)

diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index 32c6ccc2a6be..8747ffef200f 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -6,7 +6,6 @@
*
* Author(s): David Hildenbrand <[email protected]>
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c
index 9423ad439a61..53c257f6159c 100644
--- a/tools/testing/selftests/mm/gup_longterm.c
+++ b/tools/testing/selftests/mm/gup_longterm.c
@@ -6,7 +6,6 @@
*
* Author(s): David Hildenbrand <[email protected]>
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/mm/hugepage-mmap.c b/tools/testing/selftests/mm/hugepage-mmap.c
index 267eea2e0e0b..edb46888222f 100644
--- a/tools/testing/selftests/mm/hugepage-mmap.c
+++ b/tools/testing/selftests/mm/hugepage-mmap.c
@@ -16,7 +16,6 @@
* range.
* Other architectures, such as ppc64, i386 or x86_64 are not so constrained.
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/mm/hugepage-mremap.c b/tools/testing/selftests/mm/hugepage-mremap.c
index c463d1c09c9b..8e22822bb754 100644
--- a/tools/testing/selftests/mm/hugepage-mremap.c
+++ b/tools/testing/selftests/mm/hugepage-mremap.c
@@ -11,8 +11,6 @@
* To make sure the test triggers pmd sharing and goes through the 'unshare'
* path in the mremap code use 1GB (1024) or more.
*/
-
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c
index e74107185324..70c40c67bc5d 100644
--- a/tools/testing/selftests/mm/hugetlb-madvise.c
+++ b/tools/testing/selftests/mm/hugetlb-madvise.c
@@ -11,8 +11,6 @@
* filesystem. Therefore, a hugetlbfs filesystem must be mounted on some
* directory.
*/
-
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/mm/hugetlb-read-hwpoison.c b/tools/testing/selftests/mm/hugetlb-read-hwpoison.c
index ba6cc6f9cabc..6b8b41b4f754 100644
--- a/tools/testing/selftests/mm/hugetlb-read-hwpoison.c
+++ b/tools/testing/selftests/mm/hugetlb-read-hwpoison.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
index 829320a519e7..d18bf400dae6 100644
--- a/tools/testing/selftests/mm/khugepaged.c
+++ b/tools/testing/selftests/mm/khugepaged.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/mm/ksm_functional_tests.c b/tools/testing/selftests/mm/ksm_functional_tests.c
index 37de82da9be7..b0af40ddb0fb 100644
--- a/tools/testing/selftests/mm/ksm_functional_tests.c
+++ b/tools/testing/selftests/mm/ksm_functional_tests.c
@@ -6,7 +6,6 @@
*
* Author(s): David Hildenbrand <[email protected]>
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c
index ef7d911da13e..f2c8223ff3d4 100644
--- a/tools/testing/selftests/mm/madv_populate.c
+++ b/tools/testing/selftests/mm/madv_populate.c
@@ -6,7 +6,6 @@
*
* Author(s): David Hildenbrand <[email protected]>
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/mm/map_populate.c b/tools/testing/selftests/mm/map_populate.c
index 5c8a53869b1b..ff4d4079bd0e 100644
--- a/tools/testing/selftests/mm/map_populate.c
+++ b/tools/testing/selftests/mm/map_populate.c
@@ -4,8 +4,6 @@
*
* MAP_POPULATE | MAP_PRIVATE should COW VMA pages.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
diff --git a/tools/testing/selftests/mm/memfd_secret.c b/tools/testing/selftests/mm/memfd_secret.c
index 9a0597310a76..0ba721d45d35 100644
--- a/tools/testing/selftests/mm/memfd_secret.c
+++ b/tools/testing/selftests/mm/memfd_secret.c
@@ -4,8 +4,6 @@
*
* Author: Mike Rapoport <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <sys/uio.h>
#include <sys/mman.h>
#include <sys/wait.h>
diff --git a/tools/testing/selftests/mm/mlock2-tests.c b/tools/testing/selftests/mm/mlock2-tests.c
index 7f0d50fa361d..99dc39bf2fec 100644
--- a/tools/testing/selftests/mm/mlock2-tests.c
+++ b/tools/testing/selftests/mm/mlock2-tests.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sys/mman.h>
#include <stdint.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/mm/mrelease_test.c b/tools/testing/selftests/mm/mrelease_test.c
index 100370a7111d..d78bf686e99f 100644
--- a/tools/testing/selftests/mm/mrelease_test.c
+++ b/tools/testing/selftests/mm/mrelease_test.c
@@ -2,7 +2,6 @@
/*
* Copyright 2022 Google LLC
*/
-#define _GNU_SOURCE
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/mm/mremap_dontunmap.c b/tools/testing/selftests/mm/mremap_dontunmap.c
index 1d75084b9ca5..934fa6b441b2 100644
--- a/tools/testing/selftests/mm/mremap_dontunmap.c
+++ b/tools/testing/selftests/mm/mremap_dontunmap.c
@@ -5,7 +5,6 @@
*
* Copyright 2020, Brian Geffon <[email protected]>
*/
-#define _GNU_SOURCE
#include <sys/mman.h>
#include <linux/mman.h>
#include <errno.h>
diff --git a/tools/testing/selftests/mm/mremap_test.c b/tools/testing/selftests/mm/mremap_test.c
index 1b03bcfaefdf..0d8dc16b63be 100644
--- a/tools/testing/selftests/mm/mremap_test.c
+++ b/tools/testing/selftests/mm/mremap_test.c
@@ -2,8 +2,6 @@
/*
* Copyright 2020 Google LLC
*/
-#define _GNU_SOURCE
-
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c
index 41998cf1dcf5..d35ee37311a7 100644
--- a/tools/testing/selftests/mm/mseal_test.c
+++ b/tools/testing/selftests/mm/mseal_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <linux/mman.h>
#include <sys/mman.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c
index 2d785aca72a5..50d6bfc8db05 100644
--- a/tools/testing/selftests/mm/pagemap_ioctl.c
+++ b/tools/testing/selftests/mm/pagemap_ioctl.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
diff --git a/tools/testing/selftests/mm/pkey-helpers.h b/tools/testing/selftests/mm/pkey-helpers.h
index 1af3156a9db8..37d6b01ce90a 100644
--- a/tools/testing/selftests/mm/pkey-helpers.h
+++ b/tools/testing/selftests/mm/pkey-helpers.h
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _PKEYS_HELPER_H
#define _PKEYS_HELPER_H
-#define _GNU_SOURCE
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index 48dc151f8fca..9f7de92caeda 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -21,7 +21,6 @@
* gcc -mxsave -o protection_keys -O2 -g -std=gnu99 -pthread -Wall protection_keys.c -lrt -ldl -lm
* gcc -mxsave -m32 -o protection_keys_32 -O2 -g -std=gnu99 -pthread -Wall protection_keys.c -lrt -ldl -lm
*/
-#define _GNU_SOURCE
#define __SANE_USERSPACE_TYPES__
#include <errno.h>
#include <linux/elf.h>
diff --git a/tools/testing/selftests/mm/seal_elf.c b/tools/testing/selftests/mm/seal_elf.c
index f2babec79bb6..0438695bc45a 100644
--- a/tools/testing/selftests/mm/seal_elf.c
+++ b/tools/testing/selftests/mm/seal_elf.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sys/mman.h>
#include <stdint.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index d3c7f5fb3e7b..ae6ac950d7a1 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -3,8 +3,6 @@
* A test of splitting PMD THPs and PTE-mapped THPs from a specified virtual
* address range in a process via <debugfs>/split_huge_pages interface.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c
index ea7fd8fe2876..28a5c31bd791 100644
--- a/tools/testing/selftests/mm/thuge-gen.c
+++ b/tools/testing/selftests/mm/thuge-gen.c
@@ -12,8 +12,6 @@
ipcrm -m by hand, like this
sudo ipcs | awk '$1 == "0x00000000" {print $2}' | xargs -n1 sudo ipcrm -m
(warning this will remove all if someone else uses them) */
-
-#define _GNU_SOURCE 1
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/mm/uffd-common.h b/tools/testing/selftests/mm/uffd-common.h
index cc5629c3d2aa..abb44319264a 100644
--- a/tools/testing/selftests/mm/uffd-common.h
+++ b/tools/testing/selftests/mm/uffd-common.h
@@ -7,7 +7,6 @@
#ifndef __UFFD_COMMON_H__
#define __UFFD_COMMON_H__

-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:22:41

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 55/68] selftests/seccomp: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/seccomp/seccomp_benchmark.c | 1 -
tools/testing/selftests/seccomp/seccomp_bpf.c | 2 --
2 files changed, 3 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_benchmark.c b/tools/testing/selftests/seccomp/seccomp_benchmark.c
index b83099160fbc..3632a4890da9 100644
--- a/tools/testing/selftests/seccomp/seccomp_benchmark.c
+++ b/tools/testing/selftests/seccomp/seccomp_benchmark.c
@@ -2,7 +2,6 @@
* Strictly speaking, this is not a test. But it can report during test
* runs so relative performace can be measured.
*/
-#define _GNU_SOURCE
#include <assert.h>
#include <err.h>
#include <limits.h>
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 783ebce8c4de..972ccc12553e 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -4,8 +4,6 @@
*
* Test code for seccomp bpf.
*/
-
-#define _GNU_SOURCE
#include <sys/types.h>

/*
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:22:58

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 37/68] selftests/net: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/net/tcp_ao/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/tcp_ao/Makefile b/tools/testing/selftests/net/tcp_ao/Makefile
index 522d991e310e..c608b1ec02e6 100644
--- a/tools/testing/selftests/net/tcp_ao/Makefile
+++ b/tools/testing/selftests/net/tcp_ao/Makefile
@@ -26,7 +26,7 @@ LIB := $(LIBDIR)/libaotst.a
LDLIBS += $(LIB) -pthread
LIBDEPS := lib/aolib.h Makefile

-CFLAGS := -Wall -O2 -g -D_GNU_SOURCE -fno-strict-aliasing
+CFLAGS := -Wall -O2 -g -fno-strict-aliasing
CFLAGS += $(KHDR_INCLUDES)
CFLAGS += -iquote ./lib/ -I ../../../../include/

--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:23:02

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 58/68] selftests/splice: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/splice/default_file_splice_read.c | 1 -
tools/testing/selftests/splice/splice_read.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/tools/testing/selftests/splice/default_file_splice_read.c b/tools/testing/selftests/splice/default_file_splice_read.c
index a3c6e5672e09..a46c5ffb573d 100644
--- a/tools/testing/selftests/splice/default_file_splice_read.c
+++ b/tools/testing/selftests/splice/default_file_splice_read.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <fcntl.h>

int main(int argc, char **argv)
diff --git a/tools/testing/selftests/splice/splice_read.c b/tools/testing/selftests/splice/splice_read.c
index 46dae6a25cfb..418a03837938 100644
--- a/tools/testing/selftests/splice/splice_read.c
+++ b/tools/testing/selftests/splice/splice_read.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:23:34

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 41/68] selftests/pid_namespace: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/pid_namespace/regression_enomem.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/pid_namespace/regression_enomem.c b/tools/testing/selftests/pid_namespace/regression_enomem.c
index 7d84097ad45c..54dc8f16d92a 100644
--- a/tools/testing/selftests/pid_namespace/regression_enomem.c
+++ b/tools/testing/selftests/pid_namespace/regression_enomem.c
@@ -1,4 +1,3 @@
-#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:23:43

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 59/68] selftests/syscall_user_dispatch: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c | 2 --
tools/testing/selftests/syscall_user_dispatch/sud_test.c | 2 --
2 files changed, 4 deletions(-)

diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
index 073a03702ff5..758fa910e510 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
@@ -4,8 +4,6 @@
*
* Benchmark and test syscall user dispatch
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_test.c b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
index d975a6767329..76e8f3d91537 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_test.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
@@ -4,8 +4,6 @@
*
* Test code for syscall user dispatch
*/
-
-#define _GNU_SOURCE
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#include <sys/syscall.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:23:44

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 60/68] selftests/thermal: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
.../selftests/thermal/intel/power_floor/power_floor_test.c | 3 ---
.../selftests/thermal/intel/workload_hint/workload_hint_test.c | 3 ---
2 files changed, 6 deletions(-)

diff --git a/tools/testing/selftests/thermal/intel/power_floor/power_floor_test.c b/tools/testing/selftests/thermal/intel/power_floor/power_floor_test.c
index 0326b39a11b9..ce98ab045ae9 100644
--- a/tools/testing/selftests/thermal/intel/power_floor/power_floor_test.c
+++ b/tools/testing/selftests/thermal/intel/power_floor/power_floor_test.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c b/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c
index 217c3a641c53..5153d42754d6 100644
--- a/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c
+++ b/tools/testing/selftests/thermal/intel/workload_hint/workload_hint_test.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:24:10

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 32/68] selftests/mount: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/mount/nosymfollow-test.c | 1 -
tools/testing/selftests/mount/unprivileged-remount-test.c | 1 -
2 files changed, 2 deletions(-)

diff --git a/tools/testing/selftests/mount/nosymfollow-test.c b/tools/testing/selftests/mount/nosymfollow-test.c
index 650d6d80a1d2..285453750ffc 100644
--- a/tools/testing/selftests/mount/nosymfollow-test.c
+++ b/tools/testing/selftests/mount/nosymfollow-test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c
index d2917054fe3a..daffcf5c2f6d 100644
--- a/tools/testing/selftests/mount/unprivileged-remount-test.c
+++ b/tools/testing/selftests/mount/unprivileged-remount-test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:24:32

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 62/68] selftests/tmpfs: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/tmpfs/Makefile | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/tmpfs/Makefile b/tools/testing/selftests/tmpfs/Makefile
index aa11ccc92e5b..3be931e1193f 100644
--- a/tools/testing/selftests/tmpfs/Makefile
+++ b/tools/testing/selftests/tmpfs/Makefile
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
CFLAGS += -Wall -O2
-CFLAGS += -D_GNU_SOURCE

TEST_GEN_PROGS :=
TEST_GEN_PROGS += bug-link-o-tmpfile
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:24:40

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 57/68] selftests/sgx: Compile with -D_GNU_SOURCE

Add -D_GNU_SOURCE to HOST_CFLAGS and remove #define _GNU_SOURCE.

Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-lkp/[email protected]
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/sgx/Makefile | 2 +-
tools/testing/selftests/sgx/sigstruct.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/selftests/sgx/Makefile b/tools/testing/selftests/sgx/Makefile
index 867f88ce2570..272da790d9ae 100644
--- a/tools/testing/selftests/sgx/Makefile
+++ b/tools/testing/selftests/sgx/Makefile
@@ -12,7 +12,7 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
endif

INCLUDES := -I$(top_srcdir)/tools/include
-HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC
+HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC -D_GNU_SOURCE
HOST_LDFLAGS := -z noexecstack -lcrypto
ENCL_CFLAGS += -Wall -Werror -static-pie -nostdlib -ffreestanding -fPIE \
-fno-stack-protector -mrdrnd $(INCLUDES)
diff --git a/tools/testing/selftests/sgx/sigstruct.c b/tools/testing/selftests/sgx/sigstruct.c
index d73b29becf5b..200034a0fee5 100644
--- a/tools/testing/selftests/sgx/sigstruct.c
+++ b/tools/testing/selftests/sgx/sigstruct.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2016-20 Intel Corporation. */

-#define _GNU_SOURCE
#include <assert.h>
#include <getopt.h>
#include <stdbool.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:25:24

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 34/68] selftests/move_mount_set_group: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
.../selftests/move_mount_set_group/move_mount_set_group_test.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
index bcf51d785a37..bd975670f61d 100644
--- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
+++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:25:49

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 63/68] selftests/uevent: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/uevent/uevent_filtering.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/uevent/uevent_filtering.c b/tools/testing/selftests/uevent/uevent_filtering.c
index dbe55f3a66f4..e308eaf3fc37 100644
--- a/tools/testing/selftests/uevent/uevent_filtering.c
+++ b/tools/testing/selftests/uevent/uevent_filtering.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <linux/netlink.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:25:54

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 64/68] selftests/user_events: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/user_events/abi_test.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/user_events/abi_test.c b/tools/testing/selftests/user_events/abi_test.c
index 7288a05136ba..a1f156dbbd56 100644
--- a/tools/testing/selftests/user_events/abi_test.c
+++ b/tools/testing/selftests/user_events/abi_test.c
@@ -4,8 +4,6 @@
*
* Copyright (c) 2022 Beau Belgrave <[email protected]>
*/
-
-#define _GNU_SOURCE
#include <sched.h>

#include <errno.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:26:07

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 65/68] selftests/vDSO: Append to CFLAGS in Makefile

Instead of overwriting the CFLAGS that is imported from lib.mk, append
to it instead.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/vDSO/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index d53a4d8008f9..fd36979435b6 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -12,7 +12,7 @@ TEST_GEN_PROGS += $(OUTPUT)/vdso_standalone_test_x86
endif
TEST_GEN_PROGS += $(OUTPUT)/vdso_test_correctness

-CFLAGS := -std=gnu99
+CFLAGS += -std=gnu99
CFLAGS_vdso_standalone_test_x86 := -nostdlib -fno-asynchronous-unwind-tables -fno-stack-protector
LDFLAGS_vdso_test_correctness := -ldl
ifeq ($(CONFIG_X86_32),y)
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:26:09

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 66/68] selftests/vDSO: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/vDSO/vdso_test_abi.c | 1 -
tools/testing/selftests/vDSO/vdso_test_clock_getres.c | 2 --
tools/testing/selftests/vDSO/vdso_test_correctness.c | 3 ---
3 files changed, 6 deletions(-)

diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index 96d32fd65b42..fb01e6ffb9a0 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -14,7 +14,6 @@
#include <time.h>
#include <sys/auxv.h>
#include <sys/time.h>
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>

diff --git a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c b/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
index 38d46a8bf7cb..f0adb906c8bd 100644
--- a/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
+++ b/tools/testing/selftests/vDSO/vdso_test_clock_getres.c
@@ -10,8 +10,6 @@
* Power (32-bit and 64-bit), S390x (32-bit and 64-bit).
* Might work on other architectures.
*/
-
-#define _GNU_SOURCE
#include <elf.h>
#include <err.h>
#include <fcntl.h>
diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
index e691a3cf1491..c435b7a5b38d 100644
--- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
+++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
@@ -3,9 +3,6 @@
* ldt_gdt.c - Test cases for LDT and GDT access
* Copyright (c) 2011-2015 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:26:27

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 67/68] selftests/x86: Append to CFLAGS in Makefile

Instead of overwriting the CFLAGS that is imported from lib.mk, append
to it instead.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/x86/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
index 0b872c0a42d2..3395a5d114c2 100644
--- a/tools/testing/selftests/x86/Makefile
+++ b/tools/testing/selftests/x86/Makefile
@@ -35,7 +35,7 @@ BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))

-CFLAGS := -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)
+CFLAGS += -O2 -g -std=gnu99 -pthread -Wall $(KHDR_INCLUDES)

# call32_from_64 in thunks.S uses absolute addresses.
ifeq ($(CAN_BUILD_WITH_NOPIE),1)
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:26:54

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 68/68] selftests/x86: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Drop #define __USE_GNU too, as it is bad practice and the GNU extensions
aren't actually being used in test_FCMOV, etc. where it is being defined.

Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>
Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/x86/amx.c | 2 --
tools/testing/selftests/x86/check_initial_reg_state.c | 3 ---
tools/testing/selftests/x86/corrupt_xstate_header.c | 3 ---
tools/testing/selftests/x86/entry_from_vm86.c | 3 ---
tools/testing/selftests/x86/fsgsbase.c | 2 --
tools/testing/selftests/x86/fsgsbase_restore.c | 2 --
tools/testing/selftests/x86/ioperm.c | 2 --
tools/testing/selftests/x86/iopl.c | 2 --
tools/testing/selftests/x86/lam.c | 1 -
tools/testing/selftests/x86/ldt_gdt.c | 2 --
tools/testing/selftests/x86/mov_ss_trap.c | 2 --
tools/testing/selftests/x86/nx_stack.c | 2 --
tools/testing/selftests/x86/ptrace_syscall.c | 2 --
tools/testing/selftests/x86/sigaltstack.c | 2 --
tools/testing/selftests/x86/sigreturn.c | 3 ---
tools/testing/selftests/x86/single_step_syscall.c | 3 ---
tools/testing/selftests/x86/syscall_arg_fault.c | 3 ---
tools/testing/selftests/x86/syscall_numbering.c | 3 ---
tools/testing/selftests/x86/sysret_rip.c | 3 ---
tools/testing/selftests/x86/sysret_ss_attrs.c | 3 ---
tools/testing/selftests/x86/test_FCMOV.c | 4 ----
tools/testing/selftests/x86/test_FCOMI.c | 4 ----
tools/testing/selftests/x86/test_FISTTP.c | 4 ----
tools/testing/selftests/x86/test_mremap_vdso.c | 1 -
tools/testing/selftests/x86/test_shadow_stack.c | 3 ---
tools/testing/selftests/x86/test_syscall_vdso.c | 4 ----
tools/testing/selftests/x86/test_vsyscall.c | 3 ---
tools/testing/selftests/x86/unwind_vdso.c | 3 ---
tools/testing/selftests/x86/vdso_restorer.c | 3 ---
29 files changed, 77 deletions(-)

diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x86/amx.c
index 95aad6d8849b..3259362a7117 100644
--- a/tools/testing/selftests/x86/amx.c
+++ b/tools/testing/selftests/x86/amx.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-
-#define _GNU_SOURCE
#include <err.h>
#include <errno.h>
#include <pthread.h>
diff --git a/tools/testing/selftests/x86/check_initial_reg_state.c b/tools/testing/selftests/x86/check_initial_reg_state.c
index 3bc95f3ed585..0129cdae8abe 100644
--- a/tools/testing/selftests/x86/check_initial_reg_state.c
+++ b/tools/testing/selftests/x86/check_initial_reg_state.c
@@ -3,9 +3,6 @@
* check_initial_reg_state.c - check that execve sets the correct state
* Copyright (c) 2014-2016 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>

unsigned long ax, bx, cx, dx, si, di, bp, sp, flags;
diff --git a/tools/testing/selftests/x86/corrupt_xstate_header.c b/tools/testing/selftests/x86/corrupt_xstate_header.c
index cf9ce8fbb656..d2c746149678 100644
--- a/tools/testing/selftests/x86/corrupt_xstate_header.c
+++ b/tools/testing/selftests/x86/corrupt_xstate_header.c
@@ -4,9 +4,6 @@
*
* Based on analysis and a test case from Thomas Gleixner.
*/
-
-#define _GNU_SOURCE
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c
index d1e919b0c1dc..9fa9d4a847ac 100644
--- a/tools/testing/selftests/x86/entry_from_vm86.c
+++ b/tools/testing/selftests/x86/entry_from_vm86.c
@@ -5,9 +5,6 @@
*
* This exercises a few paths that need to special-case vm86 mode.
*/
-
-#define _GNU_SOURCE
-
#include <assert.h>
#include <stdlib.h>
#include <sys/syscall.h>
diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c
index 8c780cce941d..348134d2cefc 100644
--- a/tools/testing/selftests/x86/fsgsbase.c
+++ b/tools/testing/selftests/x86/fsgsbase.c
@@ -3,8 +3,6 @@
* fsgsbase.c, an fsgsbase test
* Copyright (c) 2014-2016 Andy Lutomirski
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/x86/fsgsbase_restore.c b/tools/testing/selftests/x86/fsgsbase_restore.c
index 6fffadc51579..88dce47ab8e6 100644
--- a/tools/testing/selftests/x86/fsgsbase_restore.c
+++ b/tools/testing/selftests/x86/fsgsbase_restore.c
@@ -12,8 +12,6 @@
*
* This is not part of fsgsbase.c, because that test is 64-bit only.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/x86/ioperm.c b/tools/testing/selftests/x86/ioperm.c
index 57ec5e99edb9..07b7c10f8d39 100644
--- a/tools/testing/selftests/x86/ioperm.c
+++ b/tools/testing/selftests/x86/ioperm.c
@@ -3,8 +3,6 @@
* ioperm.c - Test case for ioperm(2)
* Copyright (c) 2015 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
#include <err.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/x86/iopl.c b/tools/testing/selftests/x86/iopl.c
index 7e3e09c1abac..baa691154905 100644
--- a/tools/testing/selftests/x86/iopl.c
+++ b/tools/testing/selftests/x86/iopl.c
@@ -3,8 +3,6 @@
* iopl.c - Test case for a Linux on Xen 64-bit bug
* Copyright (c) 2015 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
#include <err.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c
index 0ea4f6813930..cbfb19d546fa 100644
--- a/tools/testing/selftests/x86/lam.c
+++ b/tools/testing/selftests/x86/lam.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c
index 3a29346e1452..3b4237a85a12 100644
--- a/tools/testing/selftests/x86/ldt_gdt.c
+++ b/tools/testing/selftests/x86/ldt_gdt.c
@@ -3,8 +3,6 @@
* ldt_gdt.c - Test cases for LDT and GDT access
* Copyright (c) 2015 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
#include <err.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/tools/testing/selftests/x86/mov_ss_trap.c b/tools/testing/selftests/x86/mov_ss_trap.c
index cc3de6ff9fba..47ecc63220b7 100644
--- a/tools/testing/selftests/x86/mov_ss_trap.c
+++ b/tools/testing/selftests/x86/mov_ss_trap.c
@@ -19,8 +19,6 @@
*
* This should mostly cover CVE-2018-1087 and CVE-2018-8897.
*/
-#define _GNU_SOURCE
-
#include <stdlib.h>
#include <sys/ptrace.h>
#include <sys/types.h>
diff --git a/tools/testing/selftests/x86/nx_stack.c b/tools/testing/selftests/x86/nx_stack.c
index ea4a4e246879..97c5b34096cc 100644
--- a/tools/testing/selftests/x86/nx_stack.c
+++ b/tools/testing/selftests/x86/nx_stack.c
@@ -23,8 +23,6 @@
* Regular stack is completely overwritten before testing.
* Test doesn't exit SIGSEGV handler after first fault at INT3.
*/
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
#undef NDEBUG
#include <assert.h>
#include <signal.h>
diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c
index 12aaa063196e..bdc81c8bd1a7 100644
--- a/tools/testing/selftests/x86/ptrace_syscall.c
+++ b/tools/testing/selftests/x86/ptrace_syscall.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/tools/testing/selftests/x86/sigaltstack.c b/tools/testing/selftests/x86/sigaltstack.c
index f689af75e979..7f41c3a4268b 100644
--- a/tools/testing/selftests/x86/sigaltstack.c
+++ b/tools/testing/selftests/x86/sigaltstack.c
@@ -1,6 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
-
-#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c
index 5d7961a5f7f6..2054f729b2c2 100644
--- a/tools/testing/selftests/x86/sigreturn.c
+++ b/tools/testing/selftests/x86/sigreturn.c
@@ -24,9 +24,6 @@
*
* Do not run on outdated, unpatched kernels at risk of nasty crashes.
*/
-
-#define _GNU_SOURCE
-
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/x86/single_step_syscall.c b/tools/testing/selftests/x86/single_step_syscall.c
index 9a30f443e928..375f3b50a0b5 100644
--- a/tools/testing/selftests/x86/single_step_syscall.c
+++ b/tools/testing/selftests/x86/single_step_syscall.c
@@ -9,9 +9,6 @@
* immediately issues #DB from CPL 0. This requires special handling in
* the kernel.
*/
-
-#define _GNU_SOURCE
-
#include <sys/time.h>
#include <time.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/x86/syscall_arg_fault.c b/tools/testing/selftests/x86/syscall_arg_fault.c
index 461fa41a4d02..10eee1bcd015 100644
--- a/tools/testing/selftests/x86/syscall_arg_fault.c
+++ b/tools/testing/selftests/x86/syscall_arg_fault.c
@@ -3,9 +3,6 @@
* syscall_arg_fault.c - tests faults 32-bit fast syscall stack args
* Copyright (c) 2015 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/syscall_numbering.c b/tools/testing/selftests/x86/syscall_numbering.c
index 991591718bb0..c72fc8aaa4d3 100644
--- a/tools/testing/selftests/x86/syscall_numbering.c
+++ b/tools/testing/selftests/x86/syscall_numbering.c
@@ -5,9 +5,6 @@
*
* Copyright (c) 2018 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
-
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
diff --git a/tools/testing/selftests/x86/sysret_rip.c b/tools/testing/selftests/x86/sysret_rip.c
index 84d74be1d902..24bc219358a5 100644
--- a/tools/testing/selftests/x86/sysret_rip.c
+++ b/tools/testing/selftests/x86/sysret_rip.c
@@ -3,9 +3,6 @@
* sigreturn.c - tests that x86 avoids Intel SYSRET pitfalls
* Copyright (c) 2014-2016 Andrew Lutomirski
*/
-
-#define _GNU_SOURCE
-
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/x86/sysret_ss_attrs.c b/tools/testing/selftests/x86/sysret_ss_attrs.c
index 5f3d4fca440f..f8b9e0b2a0c5 100644
--- a/tools/testing/selftests/x86/sysret_ss_attrs.c
+++ b/tools/testing/selftests/x86/sysret_ss_attrs.c
@@ -7,9 +7,6 @@
* the hidden attributes set to an unusable state. Make sure the kernel
* doesn't let this happen.
*/
-
-#define _GNU_SOURCE
-
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/x86/test_FCMOV.c b/tools/testing/selftests/x86/test_FCMOV.c
index 6b5036fbb735..0c9431ba7d31 100644
--- a/tools/testing/selftests/x86/test_FCMOV.c
+++ b/tools/testing/selftests/x86/test_FCMOV.c
@@ -1,8 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#undef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#undef __USE_GNU
-#define __USE_GNU 1
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/test_FCOMI.c b/tools/testing/selftests/x86/test_FCOMI.c
index aec6692c6dcf..ba186665918d 100644
--- a/tools/testing/selftests/x86/test_FCOMI.c
+++ b/tools/testing/selftests/x86/test_FCOMI.c
@@ -1,8 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#undef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#undef __USE_GNU
-#define __USE_GNU 1
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/test_FISTTP.c b/tools/testing/selftests/x86/test_FISTTP.c
index 09789c0ce3e9..95580cdaaa32 100644
--- a/tools/testing/selftests/x86/test_FISTTP.c
+++ b/tools/testing/selftests/x86/test_FISTTP.c
@@ -1,8 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#undef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#undef __USE_GNU
-#define __USE_GNU 1
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/test_mremap_vdso.c b/tools/testing/selftests/x86/test_mremap_vdso.c
index d53959e03593..34f199b0d615 100644
--- a/tools/testing/selftests/x86/test_mremap_vdso.c
+++ b/tools/testing/selftests/x86/test_mremap_vdso.c
@@ -9,7 +9,6 @@
* Can be built statically:
* gcc -Os -Wall -static -m32 test_mremap_vdso.c
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/x86/test_shadow_stack.c b/tools/testing/selftests/x86/test_shadow_stack.c
index ee909a7927f9..ca1c13e89d8d 100644
--- a/tools/testing/selftests/x86/test_shadow_stack.c
+++ b/tools/testing/selftests/x86/test_shadow_stack.c
@@ -7,9 +7,6 @@
* special glibc shadow stack support (longjmp(), swapcontext(), etc). Just
* stick to the basics and hope the compiler doesn't do anything strange.
*/
-
-#define _GNU_SOURCE
-
#include <sys/syscall.h>
#include <asm/mman.h>
#include <sys/mman.h>
diff --git a/tools/testing/selftests/x86/test_syscall_vdso.c b/tools/testing/selftests/x86/test_syscall_vdso.c
index 8965c311bd65..5cd13279bba5 100644
--- a/tools/testing/selftests/x86/test_syscall_vdso.c
+++ b/tools/testing/selftests/x86/test_syscall_vdso.c
@@ -8,10 +8,6 @@
* Can be built statically:
* gcc -Os -Wall -static -m32 test_syscall_vdso.c thunks_32.S
*/
-#undef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#undef __USE_GNU
-#define __USE_GNU 1
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c
index d4c8e8d79d38..8e879263412d 100644
--- a/tools/testing/selftests/x86/test_vsyscall.c
+++ b/tools/testing/selftests/x86/test_vsyscall.c
@@ -1,7 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <sys/time.h>
#include <time.h>
diff --git a/tools/testing/selftests/x86/unwind_vdso.c b/tools/testing/selftests/x86/unwind_vdso.c
index 4c311e1af4c7..754f5d4d425a 100644
--- a/tools/testing/selftests/x86/unwind_vdso.c
+++ b/tools/testing/selftests/x86/unwind_vdso.c
@@ -5,9 +5,6 @@
*
* This tests __kernel_vsyscall's unwind info.
*/
-
-#define _GNU_SOURCE
-
#include <features.h>
#include <stdio.h>

diff --git a/tools/testing/selftests/x86/vdso_restorer.c b/tools/testing/selftests/x86/vdso_restorer.c
index fe99f2434155..8193de22a390 100644
--- a/tools/testing/selftests/x86/vdso_restorer.c
+++ b/tools/testing/selftests/x86/vdso_restorer.c
@@ -10,9 +10,6 @@
* 64-bit userspace has never supported sa_restorer == NULL, so this is
* 32-bit only.
*/
-
-#define _GNU_SOURCE
-
#include <err.h>
#include <stdio.h>
#include <dlfcn.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:27:36

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 46/68] selftests/proc: Drop duplicate -D_GNU_SOURCE

-D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/proc/Makefile | 1 -
1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile
index cd95369254c0..25c34cc9238e 100644
--- a/tools/testing/selftests/proc/Makefile
+++ b/tools/testing/selftests/proc/Makefile
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
CFLAGS += -Wall -O2 -Wno-unused-function
-CFLAGS += -D_GNU_SOURCE
LDFLAGS += -pthread

TEST_GEN_PROGS :=
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:29:05

by Vitaly Chikunov

[permalink] [raw]
Subject: Re: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:
> From: Mark Brown <[email protected]>
>
> Commit daef47b89efd0b7 ("selftests: Compile kselftest headers with
> -D_GNU_SOURCE") adds a static_assert() which means that things which
> would be warnings about undeclared functions get escalated into build
> failures. While we do actually want _GNU_SOURCE to be defined for users
> of kselftest_harness we haven't actually done that yet and this is
> causing widespread build breaks which were previously warnings about
> uses of asprintf() without prototypes, including causing other test
> programs in the same directory to fail to build.
>
> Since the build failures that are introduced cause additional issues due
> to make stopping builds early replace the static_assert() with a
> missing without making the error more severe than it already was. This
> will be moot once the issue is fixed properly but reduces the disruption
> while that happens.
>
> Signed-off-by: Mark Brown <[email protected]>
> Reviewed-by: Kees Cook <[email protected]>
> ---
> tools/testing/selftests/kselftest_harness.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index b634969cbb6f..8e53686b71cb 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -51,7 +51,7 @@
> #define __KSELFTEST_HARNESS_H
>
> #ifndef _GNU_SOURCE
> -#define _GNU_SOURCE
> +#warning kselftest harness requires _GNU_SOURCE to be defined

Maybe this should be `#error` if it really requires?

Thanks,

> #endif
> #include <asm/types.h>
> #include <ctype.h>
> --
> 2.45.1.288.g0e0cd299f1-goog
>

2024-05-22 01:32:09

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 44/68] selftests/powerpc: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/powerpc/benchmarks/context_switch.c | 2 --
tools/testing/selftests/powerpc/benchmarks/exec_target.c | 2 --
tools/testing/selftests/powerpc/benchmarks/fork.c | 2 --
tools/testing/selftests/powerpc/benchmarks/futex_bench.c | 3 ---
tools/testing/selftests/powerpc/dexcr/hashchk_test.c | 3 ---
tools/testing/selftests/powerpc/dscr/dscr_default_test.c | 3 ---
tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c | 3 ---
tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c | 1 -
tools/testing/selftests/powerpc/mm/exec_prot.c | 2 --
tools/testing/selftests/powerpc/mm/pkey_exec_prot.c | 2 --
tools/testing/selftests/powerpc/mm/pkey_siginfo.c | 2 --
tools/testing/selftests/powerpc/mm/tlbie_test.c | 2 --
tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c | 1 -
tools/testing/selftests/powerpc/pmu/count_instructions.c | 3 ---
tools/testing/selftests/powerpc/pmu/count_stcx_fail.c | 3 ---
tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 3 ---
.../testing/selftests/powerpc/pmu/ebb/instruction_count_test.c | 3 ---
tools/testing/selftests/powerpc/pmu/event.c | 2 --
tools/testing/selftests/powerpc/pmu/lib.c | 3 ---
tools/testing/selftests/powerpc/pmu/per_event_excludes.c | 3 ---
tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c | 3 ---
tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c | 2 --
tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c | 1 -
tools/testing/selftests/powerpc/signal/sigreturn_kernel.c | 3 ---
tools/testing/selftests/powerpc/signal/sigreturn_vdso.c | 3 ---
tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c | 2 --
tools/testing/selftests/powerpc/tm/tm-exec.c | 2 --
tools/testing/selftests/powerpc/tm/tm-poison.c | 2 --
.../testing/selftests/powerpc/tm/tm-signal-context-force-tm.c | 2 --
tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c | 2 --
tools/testing/selftests/powerpc/tm/tm-tmspr.c | 2 --
tools/testing/selftests/powerpc/tm/tm-trap.c | 2 --
tools/testing/selftests/powerpc/tm/tm-unavailable.c | 2 --
tools/testing/selftests/powerpc/utils.c | 3 ---
34 files changed, 79 deletions(-)

diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
index 96554e2794d1..0b245572bd45 100644
--- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c
+++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
@@ -4,8 +4,6 @@
*
* Copyright (C) 2015 Anton Blanchard <[email protected]>, IBM
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/benchmarks/exec_target.c b/tools/testing/selftests/powerpc/benchmarks/exec_target.c
index c14b0fc1edde..8646540037d8 100644
--- a/tools/testing/selftests/powerpc/benchmarks/exec_target.c
+++ b/tools/testing/selftests/powerpc/benchmarks/exec_target.c
@@ -5,8 +5,6 @@
*
* Copyright 2018, Anton Blanchard, IBM Corp.
*/
-
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>

diff --git a/tools/testing/selftests/powerpc/benchmarks/fork.c b/tools/testing/selftests/powerpc/benchmarks/fork.c
index d312e638cb37..327231646a2a 100644
--- a/tools/testing/selftests/powerpc/benchmarks/fork.c
+++ b/tools/testing/selftests/powerpc/benchmarks/fork.c
@@ -5,8 +5,6 @@
*
* Copyright 2018, Anton Blanchard, IBM Corp.
*/
-
-#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <getopt.h>
diff --git a/tools/testing/selftests/powerpc/benchmarks/futex_bench.c b/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
index 017057090490..0483a13c88f9 100644
--- a/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
+++ b/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
@@ -2,9 +2,6 @@
/*
* Copyright 2016, Anton Blanchard, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <sys/syscall.h>
#include <time.h>
diff --git a/tools/testing/selftests/powerpc/dexcr/hashchk_test.c b/tools/testing/selftests/powerpc/dexcr/hashchk_test.c
index 645224bdc142..2499ab7fe563 100644
--- a/tools/testing/selftests/powerpc/dexcr/hashchk_test.c
+++ b/tools/testing/selftests/powerpc/dexcr/hashchk_test.c
@@ -1,7 +1,4 @@
// SPDX-License-Identifier: GPL-2.0+
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/tools/testing/selftests/powerpc/dscr/dscr_default_test.c b/tools/testing/selftests/powerpc/dscr/dscr_default_test.c
index 60ab02525b79..fe6aff1e5dad 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr_default_test.c
+++ b/tools/testing/selftests/powerpc/dscr/dscr_default_test.c
@@ -9,9 +9,6 @@
* Copyright 2012, Anton Blanchard, IBM Corporation.
* Copyright 2015, Anshuman Khandual, IBM Corporation.
*/
-
-#define _GNU_SOURCE
-
#include "dscr.h"

#include <pthread.h>
diff --git a/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c b/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
index e2268e9183a8..93b6efdc2eef 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
+++ b/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
@@ -15,9 +15,6 @@
* Copyright 2012, Anton Blanchard, IBM Corporation.
* Copyright 2015, Anshuman Khandual, IBM Corporation.
*/
-
-#define _GNU_SOURCE
-
#include "dscr.h"
#include "utils.h"

diff --git a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
index 191ed126f118..ace7d23492c1 100644
--- a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
+++ b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
@@ -9,7 +9,6 @@
*
* Copyright 2015, Anshuman Khandual, IBM Corporation.
*/
-#define _GNU_SOURCE
#include "dscr.h"

static int test_thread_dscr(unsigned long val)
diff --git a/tools/testing/selftests/powerpc/mm/exec_prot.c b/tools/testing/selftests/powerpc/mm/exec_prot.c
index db75b2225de1..65712597cc68 100644
--- a/tools/testing/selftests/powerpc/mm/exec_prot.c
+++ b/tools/testing/selftests/powerpc/mm/exec_prot.c
@@ -6,8 +6,6 @@
*
* Test if applying execute protection on pages works as expected.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
index 0af4f02669a1..5cf72cd9694d 100644
--- a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
+++ b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
@@ -6,8 +6,6 @@
* Test if applying execute protection on pages using memory
* protection keys works as expected.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
index 2db76e56d4cb..fcaa591abf88 100644
--- a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
+++ b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
@@ -8,8 +8,6 @@
* attempted to be protected by two different keys from two competing
* threads at the same time.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/mm/tlbie_test.c b/tools/testing/selftests/powerpc/mm/tlbie_test.c
index 48344a74b212..512cd405de92 100644
--- a/tools/testing/selftests/powerpc/mm/tlbie_test.c
+++ b/tools/testing/selftests/powerpc/mm/tlbie_test.c
@@ -14,8 +14,6 @@
* and copy it back to the original area. This helps us to detect if any
* store continued to happen after we marked the memory PROT_READ.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
diff --git a/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c b/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
index d6f99eb9be65..0b9b20668fa4 100644
--- a/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
+++ b/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/powerpc/pmu/count_instructions.c b/tools/testing/selftests/powerpc/pmu/count_instructions.c
index a3984ef1e96a..57d63ff75397 100644
--- a/tools/testing/selftests/powerpc/pmu/count_instructions.c
+++ b/tools/testing/selftests/powerpc/pmu/count_instructions.c
@@ -2,9 +2,6 @@
/*
* Copyright 2013, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c b/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
index 2070a1e2b3a5..5d3bbd38528d 100644
--- a/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
+++ b/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
@@ -2,9 +2,6 @@
* Copyright 2013, Michael Ellerman, IBM Corp.
* Licensed under GPLv2.
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
index 21537d6eb6b7..e99a455e8c2e 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
@@ -2,9 +2,6 @@
/*
* Copyright 2014, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE /* For CPU_ZERO etc. */
-
#include <sched.h>
#include <sys/wait.h>
#include <setjmp.h>
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c b/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
index eed338b18e11..ab3f888922d6 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
@@ -2,9 +2,6 @@
/*
* Copyright 2014, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/pmu/event.c b/tools/testing/selftests/powerpc/pmu/event.c
index 0c1c1bdba081..5468bd2c3c5b 100644
--- a/tools/testing/selftests/powerpc/pmu/event.c
+++ b/tools/testing/selftests/powerpc/pmu/event.c
@@ -2,8 +2,6 @@
/*
* Copyright 2013, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <string.h>
diff --git a/tools/testing/selftests/powerpc/pmu/lib.c b/tools/testing/selftests/powerpc/pmu/lib.c
index 321357987408..fa208701dbdc 100644
--- a/tools/testing/selftests/powerpc/pmu/lib.c
+++ b/tools/testing/selftests/powerpc/pmu/lib.c
@@ -2,9 +2,6 @@
/*
* Copyright 2014, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE /* For CPU_ZERO etc. */
-
#include <errno.h>
#include <sched.h>
#include <setjmp.h>
diff --git a/tools/testing/selftests/powerpc/pmu/per_event_excludes.c b/tools/testing/selftests/powerpc/pmu/per_event_excludes.c
index ad32a09a6540..066e0c4799fd 100644
--- a/tools/testing/selftests/powerpc/pmu/per_event_excludes.c
+++ b/tools/testing/selftests/powerpc/pmu/per_event_excludes.c
@@ -2,9 +2,6 @@
/*
* Copyright 2014, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE
-
#include <elf.h>
#include <limits.h>
#include <stdio.h>
diff --git a/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c b/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
index e374c6b7ace6..1f7e3c63742d 100644
--- a/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
+++ b/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
@@ -16,9 +16,6 @@
*
* Copyright (C) 2018 Michael Neuling, IBM Corporation.
*/
-
-#define _GNU_SOURCE
-
#include <unistd.h>
#include <assert.h>
#include <sched.h>
diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c b/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c
index 3353210dcdbd..6e5294c1b60b 100644
--- a/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c
+++ b/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c
@@ -8,8 +8,6 @@
* test, and it was adapted to run on Powerpc by
* Breno Leitao <[email protected]>
*/
-#define _GNU_SOURCE
-
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c b/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c
index e3972264615b..8bad5e65bbb7 100644
--- a/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c
+++ b/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c
@@ -18,7 +18,6 @@
* that sucker at the same time. Same for multiple signals of any kind
* interrupting that sucker on 64bit...
*/
-#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
diff --git a/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c b/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c
index 0a1b6e591eee..772c3373560f 100644
--- a/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c
+++ b/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c
@@ -2,9 +2,6 @@
/*
* Test that we can't sigreturn to kernel addresses, or to kernel mode.
*/
-
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c b/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
index e282fff0fe25..d5aecd2c4b95 100644
--- a/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
+++ b/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
@@ -5,9 +5,6 @@
*
* See handle_rt_signal64() and setup_trampoline() in signal_64.c
*/
-
-#define _GNU_SOURCE
-
#include <errno.h>
#include <stdio.h>
#include <signal.h>
diff --git a/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c b/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
index 4c582524aeb3..a49c699d86d4 100644
--- a/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
+++ b/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
@@ -5,8 +5,6 @@
* This test simply tests that certain syscalls are implemented. It doesn't
* actually exercise their logic in any way.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-exec.c b/tools/testing/selftests/powerpc/tm/tm-exec.c
index c59919d6710d..8cfc859dcf37 100644
--- a/tools/testing/selftests/powerpc/tm/tm-exec.c
+++ b/tools/testing/selftests/powerpc/tm/tm-exec.c
@@ -8,8 +8,6 @@
* It makes little sense for after an exec() call for the previously
* suspended transaction to still exist.
*/
-
-#define _GNU_SOURCE
#include <errno.h>
#include <inttypes.h>
#include <libgen.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c
index a7bbf034b5bb..1b3a596a6a51 100644
--- a/tools/testing/selftests/powerpc/tm/tm-poison.c
+++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
@@ -11,8 +11,6 @@
* present child's poison will leak into parent's f31 or vr31 registers,
* otherwise, poison will never leak into parent's f31 and vr31 registers.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c b/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
index 421cb082f6be..f28ba2828df6 100644
--- a/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
+++ b/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
@@ -15,8 +15,6 @@
* This test never fails (as returning EXIT_FAILURE). It either succeeds,
* or crash the kernel (on a buggy kernel).
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c b/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
index 06b801906f27..73f8e7dd5a1a 100644
--- a/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
+++ b/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
@@ -8,8 +8,6 @@
* It returns from the signal handler with the CPU at suspended state, but
* without setting usercontext MSR Transaction State (TS) fields.
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-tmspr.c b/tools/testing/selftests/powerpc/tm/tm-tmspr.c
index dd5ddffa28b7..01118f7db1b2 100644
--- a/tools/testing/selftests/powerpc/tm/tm-tmspr.c
+++ b/tools/testing/selftests/powerpc/tm/tm-tmspr.c
@@ -22,8 +22,6 @@
* (b) abort transaction
* (c) check TEXASR to see if FS has been corrupted
*/
-
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-trap.c b/tools/testing/selftests/powerpc/tm/tm-trap.c
index 97cb74768e30..164b345b5bd3 100644
--- a/tools/testing/selftests/powerpc/tm/tm-trap.c
+++ b/tools/testing/selftests/powerpc/tm/tm-trap.c
@@ -26,8 +26,6 @@
* the endianness is verified on subsequent traps to determine if the
* endianness "flipped back" to the native endianness (BE).
*/
-
-#define _GNU_SOURCE
#include <error.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
index 6bf1b65b020d..712267831112 100644
--- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c
+++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
@@ -13,8 +13,6 @@
* corruption, but only for registers vs0 and vs32, which are respectively
* representatives of FP and VEC/Altivec reg sets.
*/
-
-#define _GNU_SOURCE
#include <error.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c
index e5f2d8735c64..664722a01636 100644
--- a/tools/testing/selftests/powerpc/utils.c
+++ b/tools/testing/selftests/powerpc/utils.c
@@ -2,9 +2,6 @@
/*
* Copyright 2013-2015, Michael Ellerman, IBM Corp.
*/
-
-#define _GNU_SOURCE /* For CPU_ZERO etc. */
-
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:39:57

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 56/68] selftests/sigaltstack: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/sigaltstack/sas.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/tools/testing/selftests/sigaltstack/sas.c b/tools/testing/selftests/sigaltstack/sas.c
index 07227fab1cc9..36b510de0195 100644
--- a/tools/testing/selftests/sigaltstack/sas.c
+++ b/tools/testing/selftests/sigaltstack/sas.c
@@ -6,8 +6,6 @@
* If that succeeds, then swapcontext() can be used inside sighandler safely.
*
*/
-
-#define _GNU_SOURCE
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 01:41:49

by Edward Liaw

[permalink] [raw]
Subject: [PATCH v5 61/68] selftests/timens: Drop define _GNU_SOURCE

_GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
redefinition warnings.

Signed-off-by: Edward Liaw <[email protected]>
---
tools/testing/selftests/timens/clock_nanosleep.c | 1 -
tools/testing/selftests/timens/exec.c | 1 -
tools/testing/selftests/timens/futex.c | 1 -
tools/testing/selftests/timens/gettime_perf.c | 1 -
tools/testing/selftests/timens/procfs.c | 1 -
tools/testing/selftests/timens/timens.c | 1 -
tools/testing/selftests/timens/timer.c | 1 -
tools/testing/selftests/timens/timerfd.c | 1 -
tools/testing/selftests/timens/vfork_exec.c | 1 -
9 files changed, 9 deletions(-)

diff --git a/tools/testing/selftests/timens/clock_nanosleep.c b/tools/testing/selftests/timens/clock_nanosleep.c
index 72d41b955fb2..5608f2b519e1 100644
--- a/tools/testing/selftests/timens/clock_nanosleep.c
+++ b/tools/testing/selftests/timens/clock_nanosleep.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>

#include <sys/timerfd.h>
diff --git a/tools/testing/selftests/timens/exec.c b/tools/testing/selftests/timens/exec.c
index e40dc5be2f66..7f718a3bb043 100644
--- a/tools/testing/selftests/timens/exec.c
+++ b/tools/testing/selftests/timens/exec.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/tools/testing/selftests/timens/futex.c b/tools/testing/selftests/timens/futex.c
index 6b2b9264e851..0a5a81939220 100644
--- a/tools/testing/selftests/timens/futex.c
+++ b/tools/testing/selftests/timens/futex.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>

#include <linux/unistd.h>
diff --git a/tools/testing/selftests/timens/gettime_perf.c b/tools/testing/selftests/timens/gettime_perf.c
index 6b13dc277724..9fe6690edd2a 100644
--- a/tools/testing/selftests/timens/gettime_perf.c
+++ b/tools/testing/selftests/timens/gettime_perf.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
diff --git a/tools/testing/selftests/timens/procfs.c b/tools/testing/selftests/timens/procfs.c
index 1833ca97eb24..7bc389b05799 100644
--- a/tools/testing/selftests/timens/procfs.c
+++ b/tools/testing/selftests/timens/procfs.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <math.h>
diff --git a/tools/testing/selftests/timens/timens.c b/tools/testing/selftests/timens/timens.c
index 387220791a05..7941a43155a8 100644
--- a/tools/testing/selftests/timens/timens.c
+++ b/tools/testing/selftests/timens/timens.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
diff --git a/tools/testing/selftests/timens/timer.c b/tools/testing/selftests/timens/timer.c
index 5e7f0051bd7b..378e058359c1 100644
--- a/tools/testing/selftests/timens/timer.c
+++ b/tools/testing/selftests/timens/timer.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>

#include <sys/syscall.h>
diff --git a/tools/testing/selftests/timens/timerfd.c b/tools/testing/selftests/timens/timerfd.c
index 9edd43d6b2c1..807edb9d83c9 100644
--- a/tools/testing/selftests/timens/timerfd.c
+++ b/tools/testing/selftests/timens/timerfd.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <sched.h>

#include <sys/timerfd.h>
diff --git a/tools/testing/selftests/timens/vfork_exec.c b/tools/testing/selftests/timens/vfork_exec.c
index beb7614941fb..675c6a8b2eed 100644
--- a/tools/testing/selftests/timens/vfork_exec.c
+++ b/tools/testing/selftests/timens/vfork_exec.c
@@ -1,5 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
--
2.45.1.288.g0e0cd299f1-goog


2024-05-22 02:41:31

by Casey Schaufler

[permalink] [raw]
Subject: Re: [PATCH v5 27/68] selftests/lsm: Drop define _GNU_SOURCE

On 5/21/2024 5:57 PM, Edward Liaw wrote:
> _GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
> redefinition warnings.
>
> Reviewed-by: John Hubbard <[email protected]>
> Reviewed-by: Muhammad Usama Anjum <[email protected]>
> Signed-off-by: Edward Liaw <[email protected]>

Acked-by: Casey Schaufler <[email protected]>

> ---
> tools/testing/selftests/lsm/common.c | 2 --
> tools/testing/selftests/lsm/lsm_get_self_attr_test.c | 2 --
> tools/testing/selftests/lsm/lsm_list_modules_test.c | 2 --
> tools/testing/selftests/lsm/lsm_set_self_attr_test.c | 2 --
> 4 files changed, 8 deletions(-)
>
> diff --git a/tools/testing/selftests/lsm/common.c b/tools/testing/selftests/lsm/common.c
> index 9ad258912646..1b18aac570f1 100644
> --- a/tools/testing/selftests/lsm/common.c
> +++ b/tools/testing/selftests/lsm/common.c
> @@ -4,8 +4,6 @@
> *
> * Copyright © 2023 Casey Schaufler <[email protected]>
> */
> -
> -#define _GNU_SOURCE
> #include <linux/lsm.h>
> #include <fcntl.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/lsm/lsm_get_self_attr_test.c b/tools/testing/selftests/lsm/lsm_get_self_attr_test.c
> index df215e4aa63f..7465bde3f922 100644
> --- a/tools/testing/selftests/lsm/lsm_get_self_attr_test.c
> +++ b/tools/testing/selftests/lsm/lsm_get_self_attr_test.c
> @@ -5,8 +5,6 @@
> *
> * Copyright © 2022 Casey Schaufler <[email protected]>
> */
> -
> -#define _GNU_SOURCE
> #include <linux/lsm.h>
> #include <fcntl.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/lsm/lsm_list_modules_test.c b/tools/testing/selftests/lsm/lsm_list_modules_test.c
> index 06d24d4679a6..a6b44e25c21f 100644
> --- a/tools/testing/selftests/lsm/lsm_list_modules_test.c
> +++ b/tools/testing/selftests/lsm/lsm_list_modules_test.c
> @@ -5,8 +5,6 @@
> *
> * Copyright © 2022 Casey Schaufler <[email protected]>
> */
> -
> -#define _GNU_SOURCE
> #include <linux/lsm.h>
> #include <string.h>
> #include <stdio.h>
> diff --git a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
> index 66dec47e3ca3..110c6a07e74c 100644
> --- a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
> +++ b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c
> @@ -5,8 +5,6 @@
> *
> * Copyright © 2022 Casey Schaufler <[email protected]>
> */
> -
> -#define _GNU_SOURCE
> #include <linux/lsm.h>
> #include <string.h>
> #include <stdio.h>

2024-05-22 07:43:20

by Paolo Abeni

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On Wed, 2024-05-22 at 00:56 +0000, Edward Liaw wrote:
> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
> redefinitions of _GNU_SOURCE from source code.
>
> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
> asprintf into kselftest_harness.h, which is a GNU extension and needs
> _GNU_SOURCE to either be defined prior to including headers or with the
> -D_GNU_SOURCE flag passed to the compiler.

I'm sorry for the late question, but what is the merge plan here?

Thanks!

Paolo


2024-05-22 11:23:11

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:

> to make stopping builds early replace the static_assert() with a
> missing without making the error more severe than it already was. This
> will be moot once the issue is fixed properly but reduces the disruption
> while that happens.
>
> Signed-off-by: Mark Brown <[email protected]>
> Reviewed-by: Kees Cook <[email protected]>
> ---
> tools/testing/selftests/kselftest_harness.h | 2 +-

You've not provided a Signed-off-by for this so people can't do anything
with it, please see Documentation/process/submitting-patches.rst for
details on what this is and why it's important.


Attachments:
(No filename) (667.00 B)
signature.asc (499.00 B)
Download all attachments

2024-05-22 11:39:37

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH v5 44/68] selftests/powerpc: Drop define _GNU_SOURCE

Edward Liaw <[email protected]> writes:
> _GNU_SOURCE is provided by lib.mk, so it should be dropped to prevent
> redefinition warnings.

Most of these tests build with -Werror, so the duplicate define is
actually a hard error. Can you put this patch earlier in the series at
least?

cheers

> Signed-off-by: Edward Liaw <[email protected]>
> ---
> tools/testing/selftests/powerpc/benchmarks/context_switch.c | 2 --
> tools/testing/selftests/powerpc/benchmarks/exec_target.c | 2 --
> tools/testing/selftests/powerpc/benchmarks/fork.c | 2 --
> tools/testing/selftests/powerpc/benchmarks/futex_bench.c | 3 ---
> tools/testing/selftests/powerpc/dexcr/hashchk_test.c | 3 ---
> tools/testing/selftests/powerpc/dscr/dscr_default_test.c | 3 ---
> tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c | 3 ---
> tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c | 1 -
> tools/testing/selftests/powerpc/mm/exec_prot.c | 2 --
> tools/testing/selftests/powerpc/mm/pkey_exec_prot.c | 2 --
> tools/testing/selftests/powerpc/mm/pkey_siginfo.c | 2 --
> tools/testing/selftests/powerpc/mm/tlbie_test.c | 2 --
> tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c | 1 -
> tools/testing/selftests/powerpc/pmu/count_instructions.c | 3 ---
> tools/testing/selftests/powerpc/pmu/count_stcx_fail.c | 3 ---
> tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 3 ---
> .../testing/selftests/powerpc/pmu/ebb/instruction_count_test.c | 3 ---
> tools/testing/selftests/powerpc/pmu/event.c | 2 --
> tools/testing/selftests/powerpc/pmu/lib.c | 3 ---
> tools/testing/selftests/powerpc/pmu/per_event_excludes.c | 3 ---
> tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c | 3 ---
> tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c | 2 --
> tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c | 1 -
> tools/testing/selftests/powerpc/signal/sigreturn_kernel.c | 3 ---
> tools/testing/selftests/powerpc/signal/sigreturn_vdso.c | 3 ---
> tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c | 2 --
> tools/testing/selftests/powerpc/tm/tm-exec.c | 2 --
> tools/testing/selftests/powerpc/tm/tm-poison.c | 2 --
> .../testing/selftests/powerpc/tm/tm-signal-context-force-tm.c | 2 --
> tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c | 2 --
> tools/testing/selftests/powerpc/tm/tm-tmspr.c | 2 --
> tools/testing/selftests/powerpc/tm/tm-trap.c | 2 --
> tools/testing/selftests/powerpc/tm/tm-unavailable.c | 2 --
> tools/testing/selftests/powerpc/utils.c | 3 ---
> 34 files changed, 79 deletions(-)
>
> diff --git a/tools/testing/selftests/powerpc/benchmarks/context_switch.c b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
> index 96554e2794d1..0b245572bd45 100644
> --- a/tools/testing/selftests/powerpc/benchmarks/context_switch.c
> +++ b/tools/testing/selftests/powerpc/benchmarks/context_switch.c
> @@ -4,8 +4,6 @@
> *
> * Copyright (C) 2015 Anton Blanchard <[email protected]>, IBM
> */
> -
> -#define _GNU_SOURCE
> #include <errno.h>
> #include <sched.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/benchmarks/exec_target.c b/tools/testing/selftests/powerpc/benchmarks/exec_target.c
> index c14b0fc1edde..8646540037d8 100644
> --- a/tools/testing/selftests/powerpc/benchmarks/exec_target.c
> +++ b/tools/testing/selftests/powerpc/benchmarks/exec_target.c
> @@ -5,8 +5,6 @@
> *
> * Copyright 2018, Anton Blanchard, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> #include <unistd.h>
> #include <sys/syscall.h>
>
> diff --git a/tools/testing/selftests/powerpc/benchmarks/fork.c b/tools/testing/selftests/powerpc/benchmarks/fork.c
> index d312e638cb37..327231646a2a 100644
> --- a/tools/testing/selftests/powerpc/benchmarks/fork.c
> +++ b/tools/testing/selftests/powerpc/benchmarks/fork.c
> @@ -5,8 +5,6 @@
> *
> * Copyright 2018, Anton Blanchard, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> #include <assert.h>
> #include <errno.h>
> #include <getopt.h>
> diff --git a/tools/testing/selftests/powerpc/benchmarks/futex_bench.c b/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
> index 017057090490..0483a13c88f9 100644
> --- a/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
> +++ b/tools/testing/selftests/powerpc/benchmarks/futex_bench.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2016, Anton Blanchard, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <stdio.h>
> #include <sys/syscall.h>
> #include <time.h>
> diff --git a/tools/testing/selftests/powerpc/dexcr/hashchk_test.c b/tools/testing/selftests/powerpc/dexcr/hashchk_test.c
> index 645224bdc142..2499ab7fe563 100644
> --- a/tools/testing/selftests/powerpc/dexcr/hashchk_test.c
> +++ b/tools/testing/selftests/powerpc/dexcr/hashchk_test.c
> @@ -1,7 +1,4 @@
> // SPDX-License-Identifier: GPL-2.0+
> -
> -#define _GNU_SOURCE
> -
> #include <errno.h>
> #include <fcntl.h>
> #include <limits.h>
> diff --git a/tools/testing/selftests/powerpc/dscr/dscr_default_test.c b/tools/testing/selftests/powerpc/dscr/dscr_default_test.c
> index 60ab02525b79..fe6aff1e5dad 100644
> --- a/tools/testing/selftests/powerpc/dscr/dscr_default_test.c
> +++ b/tools/testing/selftests/powerpc/dscr/dscr_default_test.c
> @@ -9,9 +9,6 @@
> * Copyright 2012, Anton Blanchard, IBM Corporation.
> * Copyright 2015, Anshuman Khandual, IBM Corporation.
> */
> -
> -#define _GNU_SOURCE
> -
> #include "dscr.h"
>
> #include <pthread.h>
> diff --git a/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c b/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
> index e2268e9183a8..93b6efdc2eef 100644
> --- a/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
> +++ b/tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
> @@ -15,9 +15,6 @@
> * Copyright 2012, Anton Blanchard, IBM Corporation.
> * Copyright 2015, Anshuman Khandual, IBM Corporation.
> */
> -
> -#define _GNU_SOURCE
> -
> #include "dscr.h"
> #include "utils.h"
>
> diff --git a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
> index 191ed126f118..ace7d23492c1 100644
> --- a/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
> +++ b/tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
> @@ -9,7 +9,6 @@
> *
> * Copyright 2015, Anshuman Khandual, IBM Corporation.
> */
> -#define _GNU_SOURCE
> #include "dscr.h"
>
> static int test_thread_dscr(unsigned long val)
> diff --git a/tools/testing/selftests/powerpc/mm/exec_prot.c b/tools/testing/selftests/powerpc/mm/exec_prot.c
> index db75b2225de1..65712597cc68 100644
> --- a/tools/testing/selftests/powerpc/mm/exec_prot.c
> +++ b/tools/testing/selftests/powerpc/mm/exec_prot.c
> @@ -6,8 +6,6 @@
> *
> * Test if applying execute protection on pages works as expected.
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
> index 0af4f02669a1..5cf72cd9694d 100644
> --- a/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
> +++ b/tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
> @@ -6,8 +6,6 @@
> * Test if applying execute protection on pages using memory
> * protection keys works as expected.
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
> index 2db76e56d4cb..fcaa591abf88 100644
> --- a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
> +++ b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
> @@ -8,8 +8,6 @@
> * attempted to be protected by two different keys from two competing
> * threads at the same time.
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/mm/tlbie_test.c b/tools/testing/selftests/powerpc/mm/tlbie_test.c
> index 48344a74b212..512cd405de92 100644
> --- a/tools/testing/selftests/powerpc/mm/tlbie_test.c
> +++ b/tools/testing/selftests/powerpc/mm/tlbie_test.c
> @@ -14,8 +14,6 @@
> * and copy it back to the original area. This helps us to detect if any
> * store continued to happen after we marked the memory PROT_READ.
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <sys/mman.h>
> #include <sys/types.h>
> diff --git a/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c b/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
> index d6f99eb9be65..0b9b20668fa4 100644
> --- a/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
> +++ b/tools/testing/selftests/powerpc/papr_vpd/papr_vpd.c
> @@ -1,5 +1,4 @@
> // SPDX-License-Identifier: GPL-2.0-only
> -#define _GNU_SOURCE
> #include <errno.h>
> #include <fcntl.h>
> #include <stdlib.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/count_instructions.c b/tools/testing/selftests/powerpc/pmu/count_instructions.c
> index a3984ef1e96a..57d63ff75397 100644
> --- a/tools/testing/selftests/powerpc/pmu/count_instructions.c
> +++ b/tools/testing/selftests/powerpc/pmu/count_instructions.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2013, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <stdio.h>
> #include <stdbool.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c b/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
> index 2070a1e2b3a5..5d3bbd38528d 100644
> --- a/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
> +++ b/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
> @@ -2,9 +2,6 @@
> * Copyright 2013, Michael Ellerman, IBM Corp.
> * Licensed under GPLv2.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <stdio.h>
> #include <stdbool.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> index 21537d6eb6b7..e99a455e8c2e 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2014, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE /* For CPU_ZERO etc. */
> -
> #include <sched.h>
> #include <sys/wait.h>
> #include <setjmp.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c b/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
> index eed338b18e11..ab3f888922d6 100644
> --- a/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
> +++ b/tools/testing/selftests/powerpc/pmu/ebb/instruction_count_test.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2014, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <stdio.h>
> #include <stdbool.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/event.c b/tools/testing/selftests/powerpc/pmu/event.c
> index 0c1c1bdba081..5468bd2c3c5b 100644
> --- a/tools/testing/selftests/powerpc/pmu/event.c
> +++ b/tools/testing/selftests/powerpc/pmu/event.c
> @@ -2,8 +2,6 @@
> /*
> * Copyright 2013, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> #include <unistd.h>
> #include <sys/syscall.h>
> #include <string.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/lib.c b/tools/testing/selftests/powerpc/pmu/lib.c
> index 321357987408..fa208701dbdc 100644
> --- a/tools/testing/selftests/powerpc/pmu/lib.c
> +++ b/tools/testing/selftests/powerpc/pmu/lib.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2014, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE /* For CPU_ZERO etc. */
> -
> #include <errno.h>
> #include <sched.h>
> #include <setjmp.h>
> diff --git a/tools/testing/selftests/powerpc/pmu/per_event_excludes.c b/tools/testing/selftests/powerpc/pmu/per_event_excludes.c
> index ad32a09a6540..066e0c4799fd 100644
> --- a/tools/testing/selftests/powerpc/pmu/per_event_excludes.c
> +++ b/tools/testing/selftests/powerpc/pmu/per_event_excludes.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2014, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <elf.h>
> #include <limits.h>
> #include <stdio.h>
> diff --git a/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c b/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
> index e374c6b7ace6..1f7e3c63742d 100644
> --- a/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
> +++ b/tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
> @@ -16,9 +16,6 @@
> *
> * Copyright (C) 2018 Michael Neuling, IBM Corporation.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <unistd.h>
> #include <assert.h>
> #include <sched.h>
> diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c b/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c
> index 3353210dcdbd..6e5294c1b60b 100644
> --- a/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c
> +++ b/tools/testing/selftests/powerpc/ptrace/ptrace-syscall.c
> @@ -8,8 +8,6 @@
> * test, and it was adapted to run on Powerpc by
> * Breno Leitao <[email protected]>
> */
> -#define _GNU_SOURCE
> -
> #include <sys/ptrace.h>
> #include <sys/types.h>
> #include <sys/wait.h>
> diff --git a/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c b/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c
> index e3972264615b..8bad5e65bbb7 100644
> --- a/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c
> +++ b/tools/testing/selftests/powerpc/signal/sig_sc_double_restart.c
> @@ -18,7 +18,6 @@
> * that sucker at the same time. Same for multiple signals of any kind
> * interrupting that sucker on 64bit...
> */
> -#define _GNU_SOURCE
> #include <sys/types.h>
> #include <sys/wait.h>
> #include <sys/syscall.h>
> diff --git a/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c b/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c
> index 0a1b6e591eee..772c3373560f 100644
> --- a/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c
> +++ b/tools/testing/selftests/powerpc/signal/sigreturn_kernel.c
> @@ -2,9 +2,6 @@
> /*
> * Test that we can't sigreturn to kernel addresses, or to kernel mode.
> */
> -
> -#define _GNU_SOURCE
> -
> #include <stdio.h>
> #include <signal.h>
> #include <stdlib.h>
> diff --git a/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c b/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
> index e282fff0fe25..d5aecd2c4b95 100644
> --- a/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
> +++ b/tools/testing/selftests/powerpc/signal/sigreturn_vdso.c
> @@ -5,9 +5,6 @@
> *
> * See handle_rt_signal64() and setup_trampoline() in signal_64.c
> */
> -
> -#define _GNU_SOURCE
> -
> #include <errno.h>
> #include <stdio.h>
> #include <signal.h>
> diff --git a/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c b/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
> index 4c582524aeb3..a49c699d86d4 100644
> --- a/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
> +++ b/tools/testing/selftests/powerpc/syscalls/ipc_unmuxed.c
> @@ -5,8 +5,6 @@
> * This test simply tests that certain syscalls are implemented. It doesn't
> * actually exercise their logic in any way.
> */
> -
> -#define _GNU_SOURCE
> #include <errno.h>
> #include <stdio.h>
> #include <unistd.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-exec.c b/tools/testing/selftests/powerpc/tm/tm-exec.c
> index c59919d6710d..8cfc859dcf37 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-exec.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-exec.c
> @@ -8,8 +8,6 @@
> * It makes little sense for after an exec() call for the previously
> * suspended transaction to still exist.
> */
> -
> -#define _GNU_SOURCE
> #include <errno.h>
> #include <inttypes.h>
> #include <libgen.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-poison.c b/tools/testing/selftests/powerpc/tm/tm-poison.c
> index a7bbf034b5bb..1b3a596a6a51 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-poison.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-poison.c
> @@ -11,8 +11,6 @@
> * present child's poison will leak into parent's f31 or vr31 registers,
> * otherwise, poison will never leak into parent's f31 and vr31 registers.
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c b/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
> index 421cb082f6be..f28ba2828df6 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-signal-context-force-tm.c
> @@ -15,8 +15,6 @@
> * This test never fails (as returning EXIT_FAILURE). It either succeeds,
> * or crash the kernel (on a buggy kernel).
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <signal.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c b/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
> index 06b801906f27..73f8e7dd5a1a 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-signal-sigreturn-nt.c
> @@ -8,8 +8,6 @@
> * It returns from the signal handler with the CPU at suspended state, but
> * without setting usercontext MSR Transaction State (TS) fields.
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <signal.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-tmspr.c b/tools/testing/selftests/powerpc/tm/tm-tmspr.c
> index dd5ddffa28b7..01118f7db1b2 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-tmspr.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-tmspr.c
> @@ -22,8 +22,6 @@
> * (b) abort transaction
> * (c) check TEXASR to see if FS has been corrupted
> */
> -
> -#define _GNU_SOURCE
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-trap.c b/tools/testing/selftests/powerpc/tm/tm-trap.c
> index 97cb74768e30..164b345b5bd3 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-trap.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-trap.c
> @@ -26,8 +26,6 @@
> * the endianness is verified on subsequent traps to determine if the
> * endianness "flipped back" to the native endianness (BE).
> */
> -
> -#define _GNU_SOURCE
> #include <error.h>
> #include <stdio.h>
> #include <stdlib.h>
> diff --git a/tools/testing/selftests/powerpc/tm/tm-unavailable.c b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
> index 6bf1b65b020d..712267831112 100644
> --- a/tools/testing/selftests/powerpc/tm/tm-unavailable.c
> +++ b/tools/testing/selftests/powerpc/tm/tm-unavailable.c
> @@ -13,8 +13,6 @@
> * corruption, but only for registers vs0 and vs32, which are respectively
> * representatives of FP and VEC/Altivec reg sets.
> */
> -
> -#define _GNU_SOURCE
> #include <error.h>
> #include <stdio.h>
> #include <stdlib.h>
> diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c
> index e5f2d8735c64..664722a01636 100644
> --- a/tools/testing/selftests/powerpc/utils.c
> +++ b/tools/testing/selftests/powerpc/utils.c
> @@ -2,9 +2,6 @@
> /*
> * Copyright 2013-2015, Michael Ellerman, IBM Corp.
> */
> -
> -#define _GNU_SOURCE /* For CPU_ZERO etc. */
> -
> #include <elf.h>
> #include <errno.h>
> #include <fcntl.h>
> --
> 2.45.1.288.g0e0cd299f1-goog

2024-05-22 12:02:45

by Jarkko Sakkinen

[permalink] [raw]
Subject: Re: [PATCH v5 57/68] selftests/sgx: Compile with -D_GNU_SOURCE

On Wed May 22, 2024 at 3:57 AM EEST, Edward Liaw wrote:
> Add -D_GNU_SOURCE to HOST_CFLAGS and remove #define _GNU_SOURCE.
>
> Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX")
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-lkp/[email protected]
> Signed-off-by: Edward Liaw <[email protected]>
> ---
> tools/testing/selftests/sgx/Makefile | 2 +-
> tools/testing/selftests/sgx/sigstruct.c | 1 -
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/sgx/Makefile b/tools/testing/selftests/sgx/Makefile
> index 867f88ce2570..272da790d9ae 100644
> --- a/tools/testing/selftests/sgx/Makefile
> +++ b/tools/testing/selftests/sgx/Makefile
> @@ -12,7 +12,7 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
> endif
>
> INCLUDES := -I$(top_srcdir)/tools/include
> -HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC
> +HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC -D_GNU_SOURCE
> HOST_LDFLAGS := -z noexecstack -lcrypto
> ENCL_CFLAGS += -Wall -Werror -static-pie -nostdlib -ffreestanding -fPIE \
> -fno-stack-protector -mrdrnd $(INCLUDES)
> diff --git a/tools/testing/selftests/sgx/sigstruct.c b/tools/testing/selftests/sgx/sigstruct.c
> index d73b29becf5b..200034a0fee5 100644
> --- a/tools/testing/selftests/sgx/sigstruct.c
> +++ b/tools/testing/selftests/sgx/sigstruct.c
> @@ -1,7 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> /* Copyright(c) 2016-20 Intel Corporation. */
>
> -#define _GNU_SOURCE
> #include <assert.h>
> #include <getopt.h>
> #include <stdbool.h>

Reviewed-by: Jarkko Sakkinen <[email protected]>

BR, Jarkko

2024-05-22 12:47:03

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH v5 23/68] selftests/iommu: Drop duplicate -D_GNU_SOURCE

On Wed, May 22, 2024 at 12:57:09AM +0000, Edward Liaw wrote:
> -D_GNU_SOURCE can be de-duplicated here, as it is added by lib.mk.
>
> Reviewed-by: John Hubbard <[email protected]>
> Reviewed-by: Muhammad Usama Anjum <[email protected]>
> Signed-off-by: Edward Liaw <[email protected]>
> ---
> tools/testing/selftests/iommu/Makefile | 2 --
> 1 file changed, 2 deletions(-)

Reviewed-by: Jason Gunthorpe <[email protected]>

Jason

2024-05-22 16:19:51

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On 5/21/24 18:56, Edward Liaw wrote:
> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
> redefinitions of _GNU_SOURCE from source code.
>
> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
> asprintf into kselftest_harness.h, which is a GNU extension and needs

Easier solution to define LINE_MAX locally. In gerenal it is advisable
to not add local defines, but it is desirable in some cases to avoid
churn like this one.

> _GNU_SOURCE to either be defined prior to including headers or with the
> -D_GNU_SOURCE flag passed to the compiler.
>

This is huge churn to all the tests and some maintainers aren't
onboard to take this change.

Is there an wasier way to fix this instead? Please explore
localized options before asking me to take this series.

thanks,
-- Shuah

2024-05-22 16:35:22

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On 5/22/24 01:42, Paolo Abeni wrote:
> On Wed, 2024-05-22 at 00:56 +0000, Edward Liaw wrote:
>> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
>> redefinitions of _GNU_SOURCE from source code.
>>
>> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
>> asprintf into kselftest_harness.h, which is a GNU extension and needs
>> _GNU_SOURCE to either be defined prior to including headers or with the
>> -D_GNU_SOURCE flag passed to the compiler.
>
> I'm sorry for the late question, but what is the merge plan here?
>


I have asked Edward Liaw explore options to localize the fix to the
problem introduced by the following commit

809216233555 ("selftests/harness: remove use of LINE_MAX")

I am not happy with the churn. I don't plan to merge this series
as it for sure.

If and when this problem gets fixed, I plan to merge the change and
take it through kselftest.

thanks,
-- Shuah

2024-05-22 17:14:05

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On Wed, 22 May 2024 10:19:33 -0600 Shuah Khan wrote:
> On 5/21/24 18:56, Edward Liaw wrote:
> > Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
> > redefinitions of _GNU_SOURCE from source code.
> >
> > 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
> > asprintf into kselftest_harness.h, which is a GNU extension and needs
>
> Easier solution to define LINE_MAX locally. In gerenal it is advisable
> to not add local defines, but it is desirable in some cases to avoid
> churn like this one.

Will the patch that Andrew applied:
https://lore.kernel.org/all/[email protected]/
make its way to Linus? As you say that's a much simpler fix.

2024-05-22 17:45:18

by Edward Liaw

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On Wed, May 22, 2024 at 10:13 AM Jakub Kicinski <[email protected]> wrote:
>
> On Wed, 22 May 2024 10:19:33 -0600 Shuah Khan wrote:
> > On 5/21/24 18:56, Edward Liaw wrote:
> > > Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
> > > redefinitions of _GNU_SOURCE from source code.
> > >
> > > 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
> > > asprintf into kselftest_harness.h, which is a GNU extension and needs
> >
> > Easier solution to define LINE_MAX locally. In gerenal it is advisable
> > to not add local defines, but it is desirable in some cases to avoid
> > churn like this one.
>
> Will the patch that Andrew applied:
> https://lore.kernel.org/all/[email protected]/
> make its way to Linus? As you say that's a much simpler fix.

Right, this patch series may be unnecessary after all, since the
problem is fixed by that patch.

It might be better to drop the series unless it is desirable to
centralize the declaration of _GNU_SOURCE to the root Makefile /
lib.mk. If that is still wanted, maybe a more palatable approach
would be to surround every instance of #define _GNU_SOURCE with
#ifndef _GNU_SOURCE first, then induce the change to CFLAGS in lib.mk.
That would prevent a partial merge from triggering build warnings.

2024-05-22 17:47:39

by Edward Liaw

[permalink] [raw]
Subject: Re: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

On Wed, May 22, 2024 at 4:21 AM Mark Brown <[email protected]> wrote:
>
> On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:
>
> > to make stopping builds early replace the static_assert() with a
> > missing without making the error more severe than it already was. This
> > will be moot once the issue is fixed properly but reduces the disruption
> > while that happens.
> >
> > Signed-off-by: Mark Brown <[email protected]>
> > Reviewed-by: Kees Cook <[email protected]>
> > ---
> > tools/testing/selftests/kselftest_harness.h | 2 +-
>
> You've not provided a Signed-off-by for this so people can't do anything
> with it, please see Documentation/process/submitting-patches.rst for
> details on what this is and why it's important.

Sorry, my mistake, I forgot to add it after cherry-picking. If added
in a reply like so would it suffice, or would I need to send another
patch?

Signed-off-by: Edward Liaw <[email protected]>

2024-05-22 18:40:55

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On 5/22/24 11:44, Edward Liaw wrote:
> On Wed, May 22, 2024 at 10:13 AM Jakub Kicinski <[email protected]> wrote:
>>
>> On Wed, 22 May 2024 10:19:33 -0600 Shuah Khan wrote:
>>> On 5/21/24 18:56, Edward Liaw wrote:
>>>> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
>>>> redefinitions of _GNU_SOURCE from source code.
>>>>
>>>> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
>>>> asprintf into kselftest_harness.h, which is a GNU extension and needs
>>>
>>> Easier solution to define LINE_MAX locally. In gerenal it is advisable
>>> to not add local defines, but it is desirable in some cases to avoid
>>> churn like this one.
>>
>> Will the patch that Andrew applied:
>> https://lore.kernel.org/all/[email protected]/
>> make its way to Linus? As you say that's a much simpler fix.
>

Thank you Jakub. Yes. This is a simpler fix.

> Right, this patch series may be unnecessary after all, since the
> problem is fixed by that patch.
>
> It might be better to drop the series unless it is desirable to
> centralize the declaration of _GNU_SOURCE to the root Makefile /
> lib.mk. If that is still wanted, maybe a more palatable approach
> would be to surround every instance of #define _GNU_SOURCE with
> #ifndef _GNU_SOURCE first, then induce the change to CFLAGS in lib.mk.
> That would prevent a partial merge from triggering build warnings.

Please drop this series.

thanks,
-- Shuah


Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

Hello:

This series was applied to riscv/linux.git (fixes)
by Tejun Heo <[email protected]>:

On Wed, 22 May 2024 00:56:46 +0000 you wrote:
> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
> redefinitions of _GNU_SOURCE from source code.
>
> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
> asprintf into kselftest_harness.h, which is a GNU extension and needs
> _GNU_SOURCE to either be defined prior to including headers or with the
> -D_GNU_SOURCE flag passed to the compiler.
>
> [...]

Here is the summary with links:
- [v5,01/68] selftests: Compile with -D_GNU_SOURCE when including lib.mk
(no matching commit)
- [v5,02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE
(no matching commit)
- [v5,03/68] selftests/arm64: Drop define _GNU_SOURCE
(no matching commit)
- [v5,04/68] selftests/arm64: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,05/68] selftests/bpf: Drop define _GNU_SOURCE
(no matching commit)
- [v5,06/68] selftests/breakpoints: Drop define _GNU_SOURCE
(no matching commit)
- [v5,07/68] selftests/cachestat: Drop define _GNU_SOURCE
(no matching commit)
- [v5,08/68] selftests/capabilities: Drop define _GNU_SOURCE
(no matching commit)
- [v5,09/68] selftests/cgroup: Drop define _GNU_SOURCE
https://git.kernel.org/riscv/c/c1457d9aad5e
- [v5,10/68] selftests/clone3: Drop define _GNU_SOURCE
(no matching commit)
- [v5,11/68] selftests/core: Drop define _GNU_SOURCE
(no matching commit)
- [v5,12/68] selftests/damon: Drop define _GNU_SOURCE
(no matching commit)
- [v5,13/68] selftests/drivers: Drop define _GNU_SOURCE
(no matching commit)
- [v5,14/68] selftests/exec: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,15/68] selftests/fchmodat2: Drop define _GNU_SOURCE
(no matching commit)
- [v5,16/68] selftests/filelock: Drop define _GNU_SOURCE
(no matching commit)
- [v5,17/68] selftests/filesystems: Drop define _GNU_SOURCE
(no matching commit)
- [v5,18/68] selftests/firmware: Drop define _GNU_SOURCE
(no matching commit)
- [v5,19/68] selftests/fpu: Drop define _GNU_SOURCE
(no matching commit)
- [v5,20/68] selftests/futex: Drop define _GNU_SOURCE
(no matching commit)
- [v5,21/68] selftests/futex: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,22/68] selftests/intel_pstate: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,23/68] selftests/iommu: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,24/68] selftests/ipc: Drop define _GNU_SOURCE
(no matching commit)
- [v5,25/68] selftests/kcmp: Drop define _GNU_SOURCE
(no matching commit)
- [v5,26/68] selftests/landlock: Drop define _GNU_SOURCE
(no matching commit)
- [v5,27/68] selftests/lsm: Drop define _GNU_SOURCE
(no matching commit)
- [v5,28/68] selftests/membarrier: Drop define _GNU_SOURCE
(no matching commit)
- [v5,29/68] selftests/memfd: Drop define _GNU_SOURCE
(no matching commit)
- [v5,30/68] selftests/mincore: Drop define _GNU_SOURCE
(no matching commit)
- [v5,31/68] selftests/mm: Drop define _GNU_SOURCE
(no matching commit)
- [v5,32/68] selftests/mount: Drop define _GNU_SOURCE
(no matching commit)
- [v5,33/68] selftests/mount_setattr: Drop define _GNU_SOURCE
(no matching commit)
- [v5,34/68] selftests/move_mount_set_group: Drop define _GNU_SOURCE
(no matching commit)
- [v5,35/68] selftests/mqueue: Drop define _GNU_SOURCE
(no matching commit)
- [v5,36/68] selftests/net: Drop define _GNU_SOURCE
(no matching commit)
- [v5,37/68] selftests/net: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,38/68] selftests/nsfs: Drop define _GNU_SOURCE
(no matching commit)
- [v5,39/68] selftests/openat2: Drop define _GNU_SOURCE
(no matching commit)
- [v5,40/68] selftests/perf_events: Drop define _GNU_SOURCE
(no matching commit)
- [v5,41/68] selftests/pid_namespace: Drop define _GNU_SOURCE
(no matching commit)
- [v5,42/68] selftests/pidfd: Drop define _GNU_SOURCE
(no matching commit)
- [v5,43/68] selftests/ptrace: Drop define _GNU_SOURCE
(no matching commit)
- [v5,44/68] selftests/powerpc: Drop define _GNU_SOURCE
(no matching commit)
- [v5,45/68] selftests/proc: Drop define _GNU_SOURCE
(no matching commit)
- [v5,46/68] selftests/proc: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,47/68] selftests/ptp: Drop define _GNU_SOURCE
(no matching commit)
- [v5,48/68] selftests/resctrl: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,49/68] selftests/riscv: Drop define _GNU_SOURCE
(no matching commit)
- [v5,50/68] selftests/riscv: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,51/68] selftests/rlimits: Drop define _GNU_SOURCE
(no matching commit)
- [v5,52/68] selftests/rseq: Drop define _GNU_SOURCE
(no matching commit)
- [v5,53/68] selftests/safesetid: Drop define _GNU_SOURCE
(no matching commit)
- [v5,54/68] selftests/sched: Drop define _GNU_SOURCE
(no matching commit)
- [v5,55/68] selftests/seccomp: Drop define _GNU_SOURCE
(no matching commit)
- [v5,56/68] selftests/sigaltstack: Drop define _GNU_SOURCE
(no matching commit)
- [v5,57/68] selftests/sgx: Compile with -D_GNU_SOURCE
(no matching commit)
- [v5,58/68] selftests/splice: Drop define _GNU_SOURCE
(no matching commit)
- [v5,59/68] selftests/syscall_user_dispatch: Drop define _GNU_SOURCE
(no matching commit)
- [v5,60/68] selftests/thermal: Drop define _GNU_SOURCE
(no matching commit)
- [v5,61/68] selftests/timens: Drop define _GNU_SOURCE
(no matching commit)
- [v5,62/68] selftests/tmpfs: Drop duplicate -D_GNU_SOURCE
(no matching commit)
- [v5,63/68] selftests/uevent: Drop define _GNU_SOURCE
(no matching commit)
- [v5,64/68] selftests/user_events: Drop define _GNU_SOURCE
(no matching commit)
- [v5,65/68] selftests/vDSO: Append to CFLAGS in Makefile
(no matching commit)
- [v5,66/68] selftests/vDSO: Drop define _GNU_SOURCE
(no matching commit)
- [v5,67/68] selftests/x86: Append to CFLAGS in Makefile
(no matching commit)
- [v5,68/68] selftests/x86: Drop define _GNU_SOURCE
(no matching commit)

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2024-05-22 23:36:44

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On 5/22/24 17:32, [email protected] wrote:
> Hello:
>
> This series was applied to riscv/linux.git (fixes)
> by Tejun Heo <[email protected]>:
>
> On Wed, 22 May 2024 00:56:46 +0000 you wrote:
>> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
>> redefinitions of _GNU_SOURCE from source code.
>>
>> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
>> asprintf into kselftest_harness.h, which is a GNU extension and needs
>> _GNU_SOURCE to either be defined prior to including headers or with the
>> -D_GNU_SOURCE flag passed to the compiler.

Hi Tejun,

Please don't. We determined this series is no longer necessary.

With the patch that Andrew applied:
https://lore.kernel.org/all/[email protected]/
make its way to Linus? As you say that's a much simpler fix.

thanks,
-- Shuah



2024-05-23 18:02:22

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

On 5/22/24 20:28, John Hubbard wrote:
> On 5/22/24 10:46 AM, Edward Liaw wrote:
>> On Wed, May 22, 2024 at 4:21 AM Mark Brown <[email protected]> wrote:
>>> On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:
> ...
>>> You've not provided a Signed-off-by for this so people can't do anything
>>> with it, please see Documentation/process/submitting-patches.rst for
>>> details on what this is and why it's important.
>>
>> Sorry, my mistake, I forgot to add it after cherry-picking.  If added
>
> Adding this to your .gitconfig would cover you for cases like this, I think
> it's pretty common to do this:
>
> [format]
>     signoff = true
>
>

Mark, Edward,

Is this patch still necessary of the series is dropped?

thanks,
-- Shuah


2024-05-23 18:08:24

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 00/68] Define _GNU_SOURCE for sources using

On 5/22/24 17:36, Shuah Khan wrote:
> On 5/22/24 17:32, [email protected] wrote:
>> Hello:
>>
>> This series was applied to riscv/linux.git (fixes)
>> by Tejun Heo <[email protected]>:
>>

Hi Tejun,

I noticed you weren't on the email I sent in response.

Please drop this series. There is simpler fix to the problem
this patch series attempts to solve with this series is already
in Linus's tree:

https://lore.kernel.org/all/[email protected]/

>> On Wed, 22 May 2024 00:56:46 +0000 you wrote:
>>> Centralizes the definition of _GNU_SOURCE into KHDR_INCLUDES and removes
>>> redefinitions of _GNU_SOURCE from source code.
>>>
>>> 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
>>> asprintf into kselftest_harness.h, which is a GNU extension and needs
>>> _GNU_SOURCE to either be defined prior to including headers or with the
>>> -D_GNU_SOURCE flag passed to the compiler.
>
> Hi Tejun,
>
> Please don't. We determined this series is no longer necessary.
>
> With the patch that Andrew applied:
> https://lore.kernel.org/all/[email protected]/
> make its way to Linus? As you say that's a much simpler fix.
>

This patch series isn't necessary and makes it problematic because all
these patches are labeled as fixes - I don't plan upon taking this series.

thanks,
-- Shuah


2024-05-23 18:13:37

by Edward Liaw

[permalink] [raw]
Subject: Re: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

On Thu, May 23, 2024 at 11:02 AM Shuah Khan <[email protected]> wrote:
>
> On 5/22/24 20:28, John Hubbard wrote:
> > On 5/22/24 10:46 AM, Edward Liaw wrote:
> >> On Wed, May 22, 2024 at 4:21 AM Mark Brown <[email protected]> wrote:
> >>> On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:
> > ...
> >>> You've not provided a Signed-off-by for this so people can't do anything
> >>> with it, please see Documentation/process/submitting-patches.rst for
> >>> details on what this is and why it's important.
> >>
> >> Sorry, my mistake, I forgot to add it after cherry-picking. If added
> >
> > Adding this to your .gitconfig would cover you for cases like this, I think
> > it's pretty common to do this:
> >
> > [format]
> > signoff = true
> >
> >

Thanks Mark, I'll add that.

>
> Mark, Edward,
>
> Is this patch still necessary of the series is dropped?
>
> thanks,
> -- Shuah
>

No, it is not necessary anymore.

2024-05-23 19:11:16

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH v5 02/68] kselftest: Desecalate reporting of missing _GNU_SOURCE

On 5/23/24 12:12, Edward Liaw wrote:
> On Thu, May 23, 2024 at 11:02 AM Shuah Khan <[email protected]> wrote:
>>
>> On 5/22/24 20:28, John Hubbard wrote:
>>> On 5/22/24 10:46 AM, Edward Liaw wrote:
>>>> On Wed, May 22, 2024 at 4:21 AM Mark Brown <[email protected]> wrote:
>>>>> On Wed, May 22, 2024 at 12:56:48AM +0000, Edward Liaw wrote:
>>> ...
>>>>> You've not provided a Signed-off-by for this so people can't do anything
>>>>> with it, please see Documentation/process/submitting-patches.rst for
>>>>> details on what this is and why it's important.
>>>>
>>>> Sorry, my mistake, I forgot to add it after cherry-picking. If added
>>>
>>> Adding this to your .gitconfig would cover you for cases like this, I think
>>> it's pretty common to do this:
>>>
>>> [format]
>>> signoff = true
>>>
>>>
>
> Thanks Mark, I'll add that.
>
>>
>> Mark, Edward,
>>
>> Is this patch still necessary of the series is dropped?
>>
>> thanks,
>> -- Shuah
>>
>
> No, it is not necessary anymore.

Thank you Edward.

thanks,
-- Shuah