]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: Remove stub-data.h include from common-offsets.h
authorBenjamin Berg <benjamin@sipsolutions.net>
Wed, 3 Jul 2024 13:45:25 +0000 (15:45 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 3 Jul 2024 15:09:48 +0000 (17:09 +0200)
Further commits will require values from common-offsets.h inside
stub-data.h. Resolve the possible circular dependency and simply use
offsetof() inside stub_32.h and stub_64.h.

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
Link: https://patch.msgid.link/20240703134536.1161108-2-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/include/shared/common-offsets.h
arch/x86/um/shared/sysdep/stub_32.h
arch/x86/um/shared/sysdep/stub_64.h

index 96195483fbd0fd7856abcfa5adcbb7aee93b2ac0..579ed946a3a9a11c4f40df86ebd09a48ce1f23a3 100644 (file)
@@ -1,6 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /* for use by sys-$SUBARCH/kernel-offsets.c */
-#include <stub-data.h>
 
 DEFINE(KERNEL_MADV_REMOVE, MADV_REMOVE);
 
@@ -30,7 +29,3 @@ DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT);
 DEFINE(UML_CONFIG_UML_TIME_TRAVEL_SUPPORT, CONFIG_UML_TIME_TRAVEL_SUPPORT);
 #endif
 
-/* for stub */
-DEFINE(UML_STUB_FIELD_OFFSET, offsetof(struct stub_data, offset));
-DEFINE(UML_STUB_FIELD_CHILD_ERR, offsetof(struct stub_data, child_err));
-DEFINE(UML_STUB_FIELD_FD, offsetof(struct stub_data, fd));
index ea8b5a2d67afb95cb2deb76efa4059f7b602771d..2748b7ee031a8bddc0ad60643a6f854897fccc2d 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef __SYSDEP_STUB_H
 #define __SYSDEP_STUB_H
 
+#include <stddef.h>
 #include <asm/ptrace.h>
 #include <generated/asm-offsets.h>
 
@@ -98,9 +99,9 @@ static __always_inline void remap_stack_and_trap(void)
                : :
                "g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1)),
                "g" (STUB_MMAP_NR),
-               "g" (UML_STUB_FIELD_FD),
-               "g" (UML_STUB_FIELD_OFFSET),
-               "g" (UML_STUB_FIELD_CHILD_ERR),
+               "g" (offsetof(struct stub_data, fd)),
+               "g" (offsetof(struct stub_data, offset)),
+               "g" (offsetof(struct stub_data, child_err)),
                "c" (STUB_DATA_PAGES * UM_KERN_PAGE_SIZE),
                "d" (PROT_READ | PROT_WRITE),
                "S" (MAP_FIXED | MAP_SHARED)
index b24168ef0ac49f7b0935688cbb6b7e3fad47ebe7..50c5e0529dfb4e0127bd1606ea7dc54eeb25fa8c 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef __SYSDEP_STUB_H
 #define __SYSDEP_STUB_H
 
+#include <stddef.h>
 #include <sysdep/ptrace_user.h>
 #include <generated/asm-offsets.h>
 #include <linux/stddef.h>
@@ -101,9 +102,9 @@ static __always_inline void remap_stack_and_trap(void)
                "g" (STUB_MMAP_NR),
                "g" (~(STUB_DATA_PAGES * UM_KERN_PAGE_SIZE - 1)),
                "g" (MAP_FIXED | MAP_SHARED),
-               "g" (UML_STUB_FIELD_FD),
-               "g" (UML_STUB_FIELD_OFFSET),
-               "g" (UML_STUB_FIELD_CHILD_ERR),
+               "g" (offsetof(struct stub_data, fd)),
+               "g" (offsetof(struct stub_data, offset)),
+               "g" (offsetof(struct stub_data, child_err)),
                "S" (STUB_DATA_PAGES * UM_KERN_PAGE_SIZE),
                "d" (PROT_READ | PROT_WRITE)
                :