mbox series

[v5,00/68] Define _GNU_SOURCE for sources using

Message ID 20240522005913.3540131-1-edliaw@google.com (mailing list archive)
Headers show
Series Define _GNU_SOURCE for sources using | expand

Message

Edward Liaw May 22, 2024, 12:56 a.m. UTC
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/20240430235057.1351993-1-edliaw@google.com/
v2: https://lore.kernel.org/linux-kselftest/20240507214254.2787305-1-edliaw@google.com/
 - 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/20240509200022.253089-1-edliaw@google.com/
 - 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/20240510000842.410729-1-edliaw@google.com/
 - 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

Comments

Paolo Abeni May 22, 2024, 7:42 a.m. UTC | #1
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
Shuah Khan May 22, 2024, 4:19 p.m. UTC | #2
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
Shuah Khan May 22, 2024, 4:35 p.m. UTC | #3
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
Jakub Kicinski May 22, 2024, 5:13 p.m. UTC | #4
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/20240519213733.2AE81C32781@smtp.kernel.org/
make its way to Linus? As you say that's a much simpler fix.
Edward Liaw May 22, 2024, 5:44 p.m. UTC | #5
On Wed, May 22, 2024 at 10:13 AM Jakub Kicinski <kuba@kernel.org> 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/20240519213733.2AE81C32781@smtp.kernel.org/
> 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.
Shuah Khan May 22, 2024, 6:40 p.m. UTC | #6
On 5/22/24 11:44, Edward Liaw wrote:
> On Wed, May 22, 2024 at 10:13 AM Jakub Kicinski <kuba@kernel.org> 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/20240519213733.2AE81C32781@smtp.kernel.org/
>> 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
patchwork-bot+linux-riscv@kernel.org May 22, 2024, 11:32 p.m. UTC | #7
Hello:

This series was applied to riscv/linux.git (fixes)
by Tejun Heo <tj@kernel.org>:

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!
Shuah Khan May 22, 2024, 11:36 p.m. UTC | #8
On 5/22/24 17:32, patchwork-bot+linux-riscv@kernel.org wrote:
> Hello:
> 
> This series was applied to riscv/linux.git (fixes)
> by Tejun Heo <tj@kernel.org>:
> 
> 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/20240519213733.2AE81C32781@smtp.kernel.org/
make its way to Linus? As you say that's a much simpler fix.

thanks,
-- Shuah
Shuah Khan May 23, 2024, 6:08 p.m. UTC | #9
On 5/22/24 17:36, Shuah Khan wrote:
> On 5/22/24 17:32, patchwork-bot+linux-riscv@kernel.org wrote:
>> Hello:
>>
>> This series was applied to riscv/linux.git (fixes)
>> by Tejun Heo <tj@kernel.org>:
>>

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/20240519213733.2AE81C32781@smtp.kernel.org/

>> 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/20240519213733.2AE81C32781@smtp.kernel.org/
> 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