KVM: selftests: Define _GNU_SOURCE for all selftests code
authorSean Christopherson <seanjc@google.com>
Tue, 23 Apr 2024 19:03:08 +0000 (12:03 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 29 Apr 2024 19:49:10 +0000 (12:49 -0700)
Define _GNU_SOURCE is the base CFLAGS instead of relying on selftests to
manually #define _GNU_SOURCE, which is repetitive and error prone.  E.g.
kselftest_harness.h requires _GNU_SOURCE for asprintf(), but if a selftest
includes kvm_test_harness.h after stdio.h, the include guards result in
the effective version of stdio.h consumed by kvm_test_harness.h not
defining asprintf():

  In file included from x86_64/fix_hypercall_test.c:12:
  In file included from include/kvm_test_harness.h:11:
 ../kselftest_harness.h:1169:2: error: call to undeclared function
  'asprintf'; ISO C99 and later do not support implicit function declarations
  [-Wimplicit-function-declaration]
   1169 |         asprintf(&test_name, "%s%s%s.%s", f->name,
        |         ^

When including the rseq selftest's "library" code, #undef _GNU_SOURCE so
that rseq.c controls whether or not it wants to build with _GNU_SOURCE.

Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Acked-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/r/20240423190308.2883084-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
57 files changed:
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/aarch64/arch_timer.c
tools/testing/selftests/kvm/aarch64/page_fault_test.c
tools/testing/selftests/kvm/aarch64/psci_test.c
tools/testing/selftests/kvm/aarch64/vgic_init.c
tools/testing/selftests/kvm/arch_timer.c
tools/testing/selftests/kvm/demand_paging_test.c
tools/testing/selftests/kvm/dirty_log_test.c
tools/testing/selftests/kvm/guest_memfd_test.c
tools/testing/selftests/kvm/hardware_disable_test.c
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/include/userfaultfd_util.h
tools/testing/selftests/kvm/kvm_binary_stats_test.c
tools/testing/selftests/kvm/kvm_create_max_vcpus.c
tools/testing/selftests/kvm/kvm_page_table_test.c
tools/testing/selftests/kvm/lib/assert.c
tools/testing/selftests/kvm/lib/kvm_util.c
tools/testing/selftests/kvm/lib/memstress.c
tools/testing/selftests/kvm/lib/test_util.c
tools/testing/selftests/kvm/lib/userfaultfd_util.c
tools/testing/selftests/kvm/lib/x86_64/sev.c
tools/testing/selftests/kvm/max_guest_memory_test.c
tools/testing/selftests/kvm/memslot_modification_stress_test.c
tools/testing/selftests/kvm/riscv/arch_timer.c
tools/testing/selftests/kvm/rseq_test.c
tools/testing/selftests/kvm/s390x/cmma_test.c
tools/testing/selftests/kvm/s390x/sync_regs_test.c
tools/testing/selftests/kvm/set_memory_region_test.c
tools/testing/selftests/kvm/steal_time.c
tools/testing/selftests/kvm/x86_64/amx_test.c
tools/testing/selftests/kvm/x86_64/exit_on_emulation_failure_test.c
tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c
tools/testing/selftests/kvm/x86_64/hyperv_cpuid.c
tools/testing/selftests/kvm/x86_64/hyperv_evmcs.c
tools/testing/selftests/kvm/x86_64/hyperv_ipi.c
tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c
tools/testing/selftests/kvm/x86_64/hyperv_tlb_flush.c
tools/testing/selftests/kvm/x86_64/nested_exceptions_test.c
tools/testing/selftests/kvm/x86_64/nx_huge_pages_test.c
tools/testing/selftests/kvm/x86_64/platform_info_test.c
tools/testing/selftests/kvm/x86_64/pmu_counters_test.c
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
tools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c
tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c
tools/testing/selftests/kvm/x86_64/set_sregs_test.c
tools/testing/selftests/kvm/x86_64/smaller_maxphyaddr_emulation_test.c
tools/testing/selftests/kvm/x86_64/smm_test.c
tools/testing/selftests/kvm/x86_64/state_test.c
tools/testing/selftests/kvm/x86_64/sync_regs_test.c
tools/testing/selftests/kvm/x86_64/ucna_injection_test.c
tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c
tools/testing/selftests/kvm/x86_64/vmx_pmu_caps_test.c
tools/testing/selftests/kvm/x86_64/vmx_preemption_timer_test.c
tools/testing/selftests/kvm/x86_64/xapic_ipi_test.c
tools/testing/selftests/kvm/x86_64/xapic_state_test.c
tools/testing/selftests/kvm/x86_64/xss_msr_test.c

index 871e2de3eb051740891345122e4eafa96c2ee94b..6de9994971c96a1e434d443eb846d30188bd1ff4 100644 (file)
@@ -226,8 +226,8 @@ LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
 endif
 CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
        -Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT \
-       -fno-builtin-memcmp -fno-builtin-memcpy -fno-builtin-memset \
-       -fno-builtin-strnlen \
+       -D_GNU_SOURCE -fno-builtin-memcmp -fno-builtin-memcpy \
+       -fno-builtin-memset -fno-builtin-strnlen \
        -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
        -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
        -I$(<D) -Iinclude/$(ARCH_DIR) -I ../rseq -I.. $(EXTRA_CFLAGS) \
index 4eaba83cdcf3d20f522e4d9a5fec5a65117ccaaf..5369959e9fc206b10de3633805532602e150d1ba 100644 (file)
@@ -5,8 +5,6 @@
  *
  * Copyright (c) 2021, Google LLC.
  */
-#define _GNU_SOURCE
-
 #include "arch_timer.h"
 #include "delay.h"
 #include "gic.h"
index 5972905275cfacee914b618348a20a3cef080011..79e99f47a9fe2f928c97d35ad5239aa3e1a001f9 100644 (file)
@@ -7,7 +7,6 @@
  * hugetlbfs with a hole). It checks that the expected handling method is
  * called (e.g., uffd faults with the right address and write/read flag).
  */
-#define _GNU_SOURCE
 #include <linux/bitmap.h>
 #include <fcntl.h>
 #include <test_util.h>
index 9b004905d1d3141c19051055c51a7900cbbdbea1..1c8c6f0c1ca30c863bfd82d71cb5ba530a36d161 100644 (file)
@@ -10,9 +10,6 @@
  *  - A test for KVM's handling of PSCI SYSTEM_SUSPEND and the associated
  *    KVM_SYSTEM_EVENT_SUSPEND UAPI.
  */
-
-#define _GNU_SOURCE
-
 #include <linux/psci.h>
 
 #include "kvm_util.h"
index eef816b80993f528569f0de79b5f5e5fcda0e289..e93022870cacd1e718282f9f1bfb6b8293326524 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Copyright (C) 2020, Red Hat, Inc.
  */
-#define _GNU_SOURCE
 #include <linux/kernel.h>
 #include <sys/syscall.h>
 #include <asm/kvm.h>
index ae1f1a6d8312347217de3b616a24e88cbb79f37d..fcebd8d81ce4e8e094a51cdeacf606eca0a2505a 100644 (file)
@@ -19,9 +19,6 @@
  *
  * Copyright (c) 2021, Google LLC.
  */
-
-#define _GNU_SOURCE
-
 #include <stdlib.h>
 #include <pthread.h>
 #include <linux/sizes.h>
index bf3609f718544fb2b5d6c116d8eec4b28c29ab98..0c4d3b6afbf8d894298bceb79f6f50eb960dcb4f 100644 (file)
@@ -6,9 +6,6 @@
  * Copyright (C) 2018, Red Hat, Inc.
  * Copyright (C) 2019, Google, Inc.
  */
-
-#define _GNU_SOURCE /* for pipe2 */
-
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
index eaad5b20854ccf095a4447245554f8ecd48e0506..bf1ebc29f22aa546d4beaafe144642160340be0d 100644 (file)
@@ -4,9 +4,6 @@
  *
  * Copyright (C) 2018, Red Hat, Inc.
  */
-
-#define _GNU_SOURCE /* for program_invocation_name */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
index 92eae206baa62ec410460fd18938b2777da58775..309fe84b84ad3f024b52e00e9c043c2cb64af6d4 100644 (file)
@@ -4,8 +4,6 @@
  *
  * Author: Chao Peng <chao.p.peng@linux.intel.com>
  */
-
-#define _GNU_SOURCE
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
index decc521fc7603b1440cbb414f94acdf042ce1c5a..bce73bcb973c8e02fe18c2ed27901fa7d1b02f2f 100644 (file)
@@ -4,9 +4,6 @@
  * kvm_arch_hardware_disable is called and it attempts to unregister the user
  * return notifiers.
  */
-
-#define _GNU_SOURCE
-
 #include <fcntl.h>
 #include <pthread.h>
 #include <semaphore.h>
index 8acca8237687007088cabae5e23df8e341dd8d9c..af02308e264e9266c2ebff55137e5b0665a2ede8 100644 (file)
 
 /*
  * Provide a version of static_assert() that is guaranteed to have an optional
- * message param.  If _ISOC11_SOURCE is defined, glibc (/usr/include/assert.h)
- * #undefs and #defines static_assert() as a direct alias to _Static_assert(),
- * i.e. effectively makes the message mandatory.  Many KVM selftests #define
- * _GNU_SOURCE for various reasons, and _GNU_SOURCE implies _ISOC11_SOURCE.  As
- * a result, static_assert() behavior is non-deterministic and may or may not
- * require a message depending on #include order.
+ * message param.  _GNU_SOURCE is defined for all KVM selftests, _GNU_SOURCE
+ * implies _ISOC11_SOURCE, and if _ISOC11_SOURCE is defined, glibc #undefs and
+ * #defines static_assert() as a direct alias to _Static_assert() (see
+ * usr/include/assert.h).  Define a custom macro instead of redefining
+ * static_assert() to avoid creating non-deterministic behavior that is
+ * dependent on include order.
  */
 #define __kvm_static_assert(expr, msg, ...) _Static_assert(expr, msg)
 #define kvm_static_assert(expr, ...) __kvm_static_assert(expr, ##__VA_ARGS__, #expr)
index 877449c345928b55953a254a2745b2a4dca727b2..a9d97c213584fd9a54c3855c1dd03706f237d35e 100644 (file)
@@ -5,9 +5,6 @@
  * Copyright (C) 2018, Red Hat, Inc.
  * Copyright (C) 2019-2022 Google LLC
  */
-
-#define _GNU_SOURCE /* for pipe2 */
-
 #include <inttypes.h>
 #include <time.h>
 #include <pthread.h>
index 698c1cfa3111be67c86e4460d55a610731787b69..f02355c3c4c2361275ae7f2e542abd93ff8a35ab 100644 (file)
@@ -6,8 +6,6 @@
  *
  * Test the fd-based interface for KVM statistics.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index b9e23265e4b3833a4fa07acca1461fb35cd8297f..c78f34699f73018ba5b86e4ba69092ff262f0314 100644 (file)
@@ -6,8 +6,6 @@
  *
  * Test for KVM_CAP_MAX_VCPUS and KVM_CAP_MAX_VCPU_ID.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index e0ba97ac1c5611a386981caf679b12910b600d8b..7759c685086b55c94a7657036431842733f1d949 100644 (file)
@@ -8,9 +8,6 @@
  * page size have been pre-allocated on your system, if you are planning to
  * use hugepages to back the guest memory for testing.
  */
-
-#define _GNU_SOURCE /* for program_invocation_name */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
index 2bd25b191d150c99caf011661b1d201b27da3ce6..b49690658c6061afe784f8218d83fa9fb4adb8e2 100644 (file)
@@ -4,9 +4,6 @@
  *
  * Copyright (C) 2018, Google LLC.
  */
-
-#define _GNU_SOURCE /* for getline(3) and strchrnul(3)*/
-
 #include "test_util.h"
 
 #include <execinfo.h>
index 9da388100f3a35a70afacd8816dafe2d8c2e8f95..c4f12e272b38895b74eff1c3cbb3137402affec7 100644 (file)
@@ -4,8 +4,6 @@
  *
  * Copyright (C) 2018, Google LLC.
  */
-
-#define _GNU_SOURCE /* for program_invocation_name */
 #include "test_util.h"
 #include "kvm_util.h"
 #include "processor.h"
index cf2c739713080f3f55e1383fb5d0a9e65f5d1dc7..555e3932e5299bd948e5633e240a2b0617e59962 100644 (file)
@@ -2,8 +2,6 @@
 /*
  * Copyright (C) 2020, Google LLC.
  */
-#define _GNU_SOURCE
-
 #include <inttypes.h>
 #include <linux/bitmap.h>
 
index 5a8f8becb12984ff52a16f01281b5d396ce318be..8ed0b74ae8373316906c313e7adb5d609a500bcd 100644 (file)
@@ -4,8 +4,6 @@
  *
  * Copyright (C) 2020, Google LLC.
  */
-
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdarg.h>
 #include <assert.h>
index f4eef6eb2dc2cc2bdefc90cbe5ac845be3a18b53..bd07568a5240a55202516bcc837115404cf3701f 100644 (file)
@@ -6,9 +6,6 @@
  * Copyright (C) 2018, Red Hat, Inc.
  * Copyright (C) 2019-2022 Google LLC
  */
-
-#define _GNU_SOURCE /* for pipe2 */
-
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
index d482029b60040067cdbe489022f789a560e554dd..e9535ee20b7fcb7c328cfae0ec868af07d6a0295 100644 (file)
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <stdint.h>
 #include <stdbool.h>
 
index 6628dc4dda89f3c12cefa7a459aed11687b91799..9b7fc3908be6d8f64417c5734c8918b4d76d2093 100644 (file)
@@ -1,6 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
index 1563619666123fed1da83a2786d309c51cde25d3..05fcf902e067104b62f2a92ee32169cd75e05eeb 100644 (file)
@@ -6,9 +6,6 @@
  * Copyright (C) 2018, Red Hat, Inc.
  * Copyright (C) 2020, Google, Inc.
  */
-
-#define _GNU_SOURCE /* for program_invocation_name */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/syscall.h>
index 0f9cabd99fd451290410f75783d65c6dcf79e55c..4b5004ef9c6b01ae52e026f873317f657e973196 100644 (file)
@@ -7,9 +7,6 @@
  *
  * Copyright (c) 2024, Intel Corporation.
  */
-
-#define _GNU_SOURCE
-
 #include "arch_timer.h"
 #include "kvm_util.h"
 #include "processor.h"
index 28f97fb520441476c374dffc0bcf24bf6553a021..0728b15b5d3a47df89553b31375a1a2114a91cd3 100644 (file)
@@ -1,5 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE /* for program_invocation_short_name */
+
+/*
+ * Include rseq.c without _GNU_SOURCE defined, before including any headers, so
+ * that rseq.c is compiled with its configuration, not KVM selftests' config.
+ */
+#undef _GNU_SOURCE
+#include "../rseq/rseq.c"
+#define _GNU_SOURCE
+
 #include <errno.h>
 #include <fcntl.h>
 #include <pthread.h>
@@ -20,8 +28,6 @@
 #include "processor.h"
 #include "test_util.h"
 
-#include "../rseq/rseq.c"
-
 /*
  * Any bug related to task migration is likely to be timing-dependent; perform
  * a large number of migrations to reduce the odds of a false negative.
index 626a2b8a203724db1f3fa395ceb8b4506b9080db..84ba79c42ab1d25f3f2e402fb5ab0d41f275a41c 100644 (file)
@@ -7,8 +7,6 @@
  * Authors:
  *  Nico Boehr <nrb@linux.ibm.com>
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 43fb25ddc3eca3a83ba14c1905972243c4bda793..53def355ccba4c3c8b2a1346da31e9e5638d4b01 100644 (file)
@@ -10,8 +10,6 @@
  *
  * Test expected behavior of the KVM_CAP_SYNC_REGS functionality.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 904d58793fc6a6ac8b30b2efecbdd20d1da573d6..c6e438c9d8516fd11865b3f31bbd8a22a5727d3c 100644 (file)
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <pthread.h>
 #include <sched.h>
index bae0c5026f82f6f16022813437797c6b28c882e8..e9231387c589e0d5cc553c7bd4aa296a9d6666ed 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Copyright (C) 2020, Red Hat, Inc.
  */
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <time.h>
 #include <sched.h>
index eae521f050e09fd6f69e896c03cf381ac05c4d71..8e5713e36d4b8a43b3e4c7c0871083c3c077e9b5 100644 (file)
@@ -6,8 +6,6 @@
  *
  * Tests for amx #NM exception and save/restore.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 6c2e5e0ceb1f7de859e23b325232c70048b9dbe3..9c21b6bccc386df4723a89079cda2b3b1c081528 100644 (file)
@@ -4,9 +4,6 @@
  *
  * Test for KVM_CAP_EXIT_ON_EMULATION_FAILURE.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
-
 #include "flds_emulation.h"
 
 #include "test_util.h"
index df351ae17029771fc9001c49034ccc997e9c167c..10b1b0ba374e6643af8e9726c30035c2c0f50045 100644 (file)
@@ -2,8 +2,6 @@
 /*
  * Copyright (C) 2023, Google LLC.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <sys/ioctl.h>
 
 #include "test_util.h"
index 5c27efbf405e1f6195204ed83d61e56acbb2991f..4f5881d4ef66d3d9baeb486536c20dc52834a327 100644 (file)
@@ -7,8 +7,6 @@
  * This work is licensed under the terms of the GNU GPL, version 2.
  *
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 4c7257ecd2a68ce6fec6c9b93f8ae83afc6e7867..4f3f3a9b038b91d8fa86576d573bfc1609599c2b 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Tests for Enlightened VMCS, including nested guest state.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index f1617762c22fecaff954824c3ca09cebec1eb78d..8206f5ef42dd114b7bc4e4df3ec962626e947e44 100644 (file)
@@ -5,8 +5,6 @@
  * Copyright (C) 2022, Red Hat, Inc.
  *
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <pthread.h>
 #include <inttypes.h>
 
index c9b18707edc03113db996d127342b4b6bfade843..b987a3d7971537bd4e3763839e153d12b038ea5f 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Tests for Hyper-V extensions to SVM.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 05b56095cf76f6b8857f7f83bccdf68b3787d759..077cd0ec3040e9c8b3fc95311c8642125d86c59c 100644 (file)
@@ -5,8 +5,6 @@
  * Copyright (C) 2022, Red Hat, Inc.
  *
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <asm/barrier.h>
 #include <pthread.h>
 #include <inttypes.h>
index 3670331adf21ad1ae9bbc3f450ea1cc1d7eed062..3eb0313ffa397add184a659f924b7767ea3b6f83 100644 (file)
@@ -1,6 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE /* for program_invocation_short_name */
-
 #include "test_util.h"
 #include "kvm_util.h"
 #include "processor.h"
index 17bbb96fc4dfcbc25e2ed62e5010d2d71a9d1746..e7efb2b35f8bdc5db3f5f47bff21eacd4bcd53a1 100644 (file)
@@ -5,9 +5,6 @@
  *
  * Copyright (C) 2022, Google LLC.
  */
-
-#define _GNU_SOURCE
-
 #include <fcntl.h>
 #include <stdint.h>
 #include <time.h>
index 87011965dc41664d46bb285fa5dd408876fe20c2..2165b1ad8b383f1d4bdf46d05ab4c2eb4f8e4065 100644 (file)
@@ -9,8 +9,6 @@
  * Verifies expected behavior of controlling guest access to
  * MSR_PLATFORM_INFO.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 29609b52f8fa0c58bfb38207ef29bf6283f43932..842d87c8d6b60cdbc30ba9073404e37cdf5952ff 100644 (file)
@@ -2,8 +2,6 @@
 /*
  * Copyright (C) 2023, Tencent, Inc.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <x86intrin.h>
 
 #include "pmu.h"
index 3c85d1ae989366fd7983c41cf7b02d0a0ba4f8f2..5ce53b8c46e02b6dd0b90e1f9043ee86d1f23aca 100644 (file)
@@ -9,9 +9,6 @@
  * Verifies the expected behavior of allow lists and deny lists for
  * virtual PMU events.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
-
 #include "kvm_util.h"
 #include "pmu.h"
 #include "processor.h"
index e0f642d2a3c4b562d186d4551583b6f5699d661b..82a8d88b5338e3aca9902fa4faaaaa970faeb51d 100644 (file)
@@ -2,7 +2,6 @@
 /*
  * Copyright (C) 2022, Google LLC.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <limits.h>
 #include <pthread.h>
index 366cf18600bc7eb736657f3d0591bcde8aabccaf..d691d86e5bc33a55f4c2fc801e3d5a872bf81332 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Copyright (C) 2020, Red Hat, Inc.
  */
-#define _GNU_SOURCE /* for program_invocation_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 3610981d9162bbbe7d03384fcc88fbe6e8110ca3..c021c0795a9666fa0eec8a5067267fade1e05363 100644 (file)
@@ -10,7 +10,6 @@
  * That bug allowed a user-mode program that called the KVM_SET_SREGS
  * ioctl to put a VCPU's local APIC into an invalid state.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 416207c38a17ea416506a3f0babea8682b9862f5..362be40fc00d0658a38cac7a761266222a56ec03 100644 (file)
@@ -5,9 +5,6 @@
  * Test that KVM emulates instructions in response to EPT violations when
  * allow_smaller_maxphyaddr is enabled and guest.MAXPHYADDR < host.MAXPHYADDR.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
-
 #include "flds_emulation.h"
 
 #include "test_util.h"
index e18b86666e1fc2d9814c287f81fae95dc9dadfa4..55c88d664a945630532ecc23f1266de2eae89c6f 100644 (file)
@@ -4,7 +4,6 @@
  *
  * Tests for SMM.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 88b58aab720773b3411e0962fbfd398b9f46ebd7..1c756db329e5752163080af1117279477ef6368f 100644 (file)
@@ -6,7 +6,6 @@
  *
  * Tests for vCPU state save/restore, including nested guest state.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index adb5593daf483ec6b84d18dda8f5ebf8823a6827..8fa3948b0170e17be0cb0c08c7ea37b95fc330d5 100644 (file)
@@ -8,8 +8,6 @@
  * including requesting an invalid register set, updates to/from values
  * in kvm_run.s.regs when kvm_valid_regs and kvm_dirty_regs are toggled.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index dcbb3c29fb8e9f82b9dce0b222111f8a8eb4776a..abe71946941f65cdf1ddc853f3b33376a13eeeb0 100644 (file)
@@ -17,8 +17,6 @@
  * delivered into the guest or not.
  *
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <pthread.h>
 #include <inttypes.h>
 #include <string.h>
index f4f61a2d2464c1911efcf2dd9b02b1ff90af9e41..53afbea4df88a909547c128f8d78d6ea45545dcd 100644 (file)
@@ -4,8 +4,6 @@
  *
  * Tests for exiting into userspace on registered MSRs
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <sys/ioctl.h>
 
 #include "kvm_test_harness.h"
index 7f6f5f23fb9b67fcb186a0e9c9ad00aaced6d2d3..a39cba19c058a85d0bb4c7256304c742b2a7995d 100644 (file)
@@ -4,9 +4,6 @@
  *
  * Copyright (C) 2018, Red Hat, Inc.
  */
-
-#define _GNU_SOURCE /* for program_invocation_name */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <linux/bitmap.h>
index ea0cb3cae0f759be3072b3facb92291edb8c2d55..3b93f262b797c310d9da3d3dfebbcdab7fa79de9 100644 (file)
@@ -10,7 +10,6 @@
  * and check it can be retrieved with KVM_GET_MSR, also test
  * the invalid LBR formats are rejected.
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <sys/ioctl.h>
 
 #include <linux/bitmap.h>
index affc32800158415225e2a5c0cd2d75ce0f727e30..00dd2ac07a61e717256e4cf7ee0509745ac2931b 100644 (file)
@@ -9,7 +9,6 @@
  * value instead of partially decayed timer value
  *
  */
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 725c206ba0b92bc9d073dcbc7d8403cb7d2f0bd1..c78e5f7551165efe4392f5b13800c3dc29cc7370 100644 (file)
@@ -19,8 +19,6 @@
  * Migration is a command line option. When used on non-numa machines will 
  * exit with error. Test is still usefull on non-numa for testing IPIs.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <getopt.h>
 #include <pthread.h>
 #include <inttypes.h>
index ab75b873a4ad8e54af11a4498a73ade2269de029..69849acd95b0afc06ca739fd1ee03ddc5be71e58 100644 (file)
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0-only
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
index 167c97abff1b816dd9792b19f71c58847f433f78..f331a4e9bae3b413556b0cafaa4dc645b0325685 100644 (file)
@@ -4,8 +4,6 @@
  *
  * Tests for the IA32_XSS MSR.
  */
-
-#define _GNU_SOURCE /* for program_invocation_short_name */
 #include <sys/ioctl.h>
 
 #include "test_util.h"