Pull uml updates from Johannes Berg: "Mostly cleanups and small things, notably: - musl libc compatibility - vDSO installation fix - TLB sync race fix for recent SMP support - build fix for 32-bit with Clang 20/21" * tag 'uml-for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: um: Disable GCOV_PROFILE_ALL on 32-bit UML with Clang 20/21 um: drivers: call kernel_strrchr() explicitly in cow_user.c um: Replace strncpy() with strnlen()+memcpy_and_pad() in strncpy_chunk_from_user() x86/um: fix vDSO installation um: Remove CONFIG_FRAME_WARN from x86_64_defconfig um: Fix pte_read() and pte_exec() for kernel mappings um: Fix potential race condition in TLB sync um: time-travel: clean up kernel-doc warnings um: avoid struct sigcontext redefinition with musl um: fix address-of CMSG_DATA() rvalue in stub
Unified · Split
| @@ -11,7 +11,9 @@ config UML · 10 unmodified lines | |||
| 11 | select ARCH_HAS_CACHE_LINE_SIZE | 11 | select ARCH_HAS_CACHE_LINE_SIZE |
| 12 | select ARCH_HAS_CPU_FINALIZE_INIT | 12 | select ARCH_HAS_CPU_FINALIZE_INIT |
| 13 | select ARCH_HAS_FORTIFY_SOURCE | 13 | select ARCH_HAS_FORTIFY_SOURCE |
| 14 | select ARCH_HAS_GCOV_PROFILE_ALL | 14 | # Clang 20 & 21 miscompute __builtin_object_size() under -fprofile-arcs |
| 15 | # on 32-bit, causing spurious compile-time errors in check_copy_size(). | ||
| 16 | select ARCH_HAS_GCOV_PROFILE_ALL if !(!64BIT && CLANG_VERSION >= 200000 && CLANG_VERSION < 220100) | ||
| 15 | select ARCH_HAS_KCOV | 17 | select ARCH_HAS_KCOV |
| 16 | select ARCH_HAS_STRNCPY_FROM_USER | 18 | select ARCH_HAS_STRNCPY_FROM_USER |
| 17 | select ARCH_HAS_STRNLEN_USER | 19 | select ARCH_HAS_STRNLEN_USER |
| @@ -60,5 +60,4 @@ CONFIG_PROC_KCORE=y · 59 unmodified lines | |||
| 60 | CONFIG_TMPFS=y | 60 | CONFIG_TMPFS=y |
| 61 | CONFIG_NLS=y | 61 | CONFIG_NLS=y |
| 62 | CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y | 62 | CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y |
| 63 | CONFIG_FRAME_WARN=1024 | ||
| 64 | CONFIG_DEBUG_KERNEL=y | 63 | CONFIG_DEBUG_KERNEL=y |
| @@ -15,6 +15,12 @@ · 14 unmodified lines | |||
| 15 | #include "cow.h" | 15 | #include "cow.h" |
| 16 | #include "cow_sys.h" | 16 | #include "cow_sys.h" |
| 17 | 17 | ||
| 18 | /* | ||
| 19 | * arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel | ||
| 20 | * name directly to avoid glibc >= 2.43's C23 strrchr macro. | ||
| 21 | */ | ||
| 22 | char *kernel_strrchr(const char *, int); | ||
| 23 | |||
| 18 | #define PATH_LEN_V1 256 | 24 | #define PATH_LEN_V1 256 |
| 19 | 25 | ||
| 20 | /* unsigned time_t works until year 2106 */ | 26 | /* unsigned time_t works until year 2106 */ |
| @@ -153,7 +159,7 @@ static int absolutize(char *to, int size, char *from) · 132 unmodified lines | |||
| 153 | errno); | 159 | errno); |
| 154 | return -1; | 160 | return -1; |
| 155 | } | 161 | } |
| 156 | slash = strrchr(from, '/'); | 162 | slash = kernel_strrchr(from, '/'); |
| 157 | if (slash != NULL) { | 163 | if (slash != NULL) { |
| 158 | *slash = '\0'; | 164 | *slash = '\0'; |
| 159 | if (chdir(from)) { | 165 | if (chdir(from)) { |
| @@ -112,13 +112,12 @@ static inline int pte_none(pte_t pte) · 111 unmodified lines | |||
| 112 | */ | 112 | */ |
| 113 | static inline int pte_read(pte_t pte) | 113 | static inline int pte_read(pte_t pte) |
| 114 | { | 114 | { |
| 115 | return((pte_get_bits(pte, _PAGE_USER)) && | 115 | return !pte_get_bits(pte, _PAGE_PROTNONE); |
| 116 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
| 117 | } | 116 | } |
| 118 | 117 | ||
| 119 | static inline int pte_exec(pte_t pte){ | 118 | static inline int pte_exec(pte_t pte) |
| 120 | return((pte_get_bits(pte, _PAGE_USER)) && | 119 | { |
| 121 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | 120 | return !pte_get_bits(pte, _PAGE_PROTNONE); |
| 122 | } | 121 | } |
| 123 | 122 | ||
| 124 | static inline int pte_write(pte_t pte) | 123 | static inline int pte_write(pte_t pte) |
| @@ -146,7 +146,7 @@ restart_wait: · 145 unmodified lines | |||
| 146 | /* Receive the FDs */ | 146 | /* Receive the FDs */ |
| 147 | num_fds = 0; | 147 | num_fds = 0; |
| 148 | fd_msg = msghdr.msg_control; | 148 | fd_msg = msghdr.msg_control; |
| 149 | fd_map = (void *)&CMSG_DATA(fd_msg); | 149 | fd_map = (void *)CMSG_DATA(fd_msg); |
| 150 | if (res == iov.iov_len && msghdr.msg_controllen > sizeof(struct cmsghdr)) | 150 | if (res == iov.iov_len && msghdr.msg_controllen > sizeof(struct cmsghdr)) |
| 151 | num_fds = (fd_msg->cmsg_len - CMSG_LEN(0)) / sizeof(int); | 151 | num_fds = (fd_msg->cmsg_len - CMSG_LEN(0)) / sizeof(int); |
| 152 | 152 | ||
| @@ -170,8 +170,8 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg) · 169 unmodified lines | |||
| 170 | char **to_ptr = arg, *to = *to_ptr; | 170 | char **to_ptr = arg, *to = *to_ptr; |
| 171 | int n; | 171 | int n; |
| 172 | 172 | ||
| 173 | strncpy(to, (void *) from, len); | 173 | n = strnlen((void *) from, len); |
| 174 | n = strnlen(to, len); | 174 | memcpy_and_pad(to, len, (void *) from, n, 0); |
| 175 | *to_ptr += n; | 175 | *to_ptr += n; |
| 176 | 176 | ||
| 177 | if (n < len) | 177 | if (n < len) |
| @@ -29,10 +29,9 @@ static int kern_map(struct mm_id *mm_idp, · 28 unmodified lines | |||
| 29 | unsigned long virt, unsigned long len, int prot, | 29 | unsigned long virt, unsigned long len, int prot, |
| 30 | int phys_fd, unsigned long long offset) | 30 | int phys_fd, unsigned long long offset) |
| 31 | { | 31 | { |
| 32 | /* TODO: Why is executable needed to be always set in the kernel? */ | ||
| 33 | return os_map_memory((void *)virt, phys_fd, offset, len, | 32 | return os_map_memory((void *)virt, phys_fd, offset, len, |
| 34 | prot & UM_PROT_READ, prot & UM_PROT_WRITE, | 33 | prot & UM_PROT_READ, prot & UM_PROT_WRITE, |
| 35 | 1); | 34 | prot & UM_PROT_EXEC); |
| 36 | } | 35 | } |
| 37 | 36 | ||
| 38 | static int kern_unmap(struct mm_id *mm_idp, | 37 | static int kern_unmap(struct mm_id *mm_idp, |
| @@ -165,6 +164,7 @@ int um_tlb_sync(struct mm_struct *mm) · 126 unmodified lines | |||
| 165 | unsigned long addr, next; | 164 | unsigned long addr, next; |
| 166 | int ret = 0; | 165 | int ret = 0; |
| 167 | 166 | ||
| 167 | guard(spinlock_irqsave)(&mm->page_table_lock); | ||
| 168 | guard(spinlock_irqsave)(&mm->context.sync_tlb_lock); | 168 | guard(spinlock_irqsave)(&mm->context.sync_tlb_lock); |
| 169 | 169 | ||
| 170 | if (mm->context.sync_tlb_range_to == 0) | 170 | if (mm->context.sync_tlb_range_to == 0) |
| @@ -60,4 +60,6 @@ ELF_FORMAT := elf64-x86-64 · 59 unmodified lines | |||
| 60 | LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64 | 60 | LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64 |
| 61 | LINK-y += -m64 | 61 | LINK-y += -m64 |
| 62 | 62 | ||
| 63 | vdso-install-y += arch/x86/um/vdso/vdso.so.dbg | ||
| 64 | |||
| 63 | endif | 65 | endif |
| @@ -4,7 +4,13 @@ · 3 unmodified lines | |||
| 4 | #include <linux/string.h> | 4 | #include <linux/string.h> |
| 5 | #include <sys/ucontext.h> | 5 | #include <sys/ucontext.h> |
| 6 | #include <asm/ptrace.h> | 6 | #include <asm/ptrace.h> |
| 7 | /* | ||
| 8 | * musl defines struct sigcontext in <bits/signal.h>. Rename the kernel's | ||
| 9 | * copy to avoid redefinition while keeping the FP-state types available. | ||
| 10 | */ | ||
| 11 | #define sigcontext __kernel_sigcontext | ||
| 7 | #include <asm/sigcontext.h> | 12 | #include <asm/sigcontext.h> |
| 13 | #undef sigcontext | ||
| 8 | #include <sysdep/ptrace.h> | 14 | #include <sysdep/ptrace.h> |
| 9 | #include <sysdep/mcontext.h> | 15 | #include <sysdep/mcontext.h> |
| 10 | #include <arch.h> | 16 | #include <arch.h> |
| @@ -3,8 +3,6 @@ · 2 unmodified lines | |||
| 3 | # Building vDSO images for x86. | 3 | # Building vDSO images for x86. |
| 4 | # | 4 | # |
| 5 | 5 | ||
| 6 | vdso-install-y += vdso.so | ||
| 7 | |||
| 8 | # files to link into the vdso | 6 | # files to link into the vdso |
| 9 | vobjs-y := vdso-note.o um_vdso.o | 7 | vobjs-y := vdso-note.o um_vdso.o |
| 10 | 8 | ||
| @@ -56,6 +56,9 @@ enum um_timetravel_shared_mem_fds { · 55 unmodified lines | |||
| 56 | * in the control message | 56 | * in the control message |
| 57 | */ | 57 | */ |
| 58 | UM_TIMETRAVEL_SHARED_LOGFD, | 58 | UM_TIMETRAVEL_SHARED_LOGFD, |
| 59 | /** | ||
| 60 | * @UM_TIMETRAVEL_SHARED_MAX_FDS: number of fds listed here | ||
| 61 | */ | ||
| 59 | UM_TIMETRAVEL_SHARED_MAX_FDS, | 62 | UM_TIMETRAVEL_SHARED_MAX_FDS, |
| 60 | }; | 63 | }; |
| 61 | 64 | ||
| @@ -242,6 +245,7 @@ union um_timetravel_schedshm_client { · 180 unmodified lines | |||
| 242 | __u64 req_time; | 245 | __u64 req_time; |
| 243 | __u64 name; | 246 | __u64 name; |
| 244 | }; | 247 | }; |
| 248 | /* private: */ | ||
| 245 | char reserve[128]; /* reserved for future usage */ | 249 | char reserve[128]; /* reserved for future usage */ |
| 246 | }; | 250 | }; |
| 247 | 251 | ||
| @@ -264,7 +268,7 @@ union um_timetravel_schedshm_client { · 16 unmodified lines | |||
| 264 | * is made by any client. Clients also must update this value when they | 268 | * is made by any client. Clients also must update this value when they |
| 265 | * insert/update an own request into the shared memory while not running | 269 | * insert/update an own request into the shared memory while not running |
| 266 | * themselves, and the new request is before than the current value. | 270 | * themselves, and the new request is before than the current value. |
| 267 | * current_time: Current time, can only be set by the client in running state | 271 | * @current_time: Current time, can only be set by the client in running state |
| 268 | * (indicated by @running_id), though that client may only run until @free_until, | 272 | * (indicated by @running_id), though that client may only run until @free_until, |
| 269 | * so it must remain smaller than @free_until. | 273 | * so it must remain smaller than @free_until. |
| 270 | * @running_id: The current client in state running, set before a client is | 274 | * @running_id: The current client in state running, set before a client is |
| @@ -570,6 +570,7 @@ config SPLIT_PTE_PTLOCKS · 569 unmodified lines | |||
| 570 | depends on !ARM || CPU_CACHE_VIPT | 570 | depends on !ARM || CPU_CACHE_VIPT |
| 571 | depends on !PARISC || PA20 | 571 | depends on !PARISC || PA20 |
| 572 | depends on !SPARC32 | 572 | depends on !SPARC32 |
| 573 | depends on !UML | ||
| 573 | 574 | ||
| 574 | config ARCH_ENABLE_SPLIT_PMD_PTLOCK | 575 | config ARCH_ENABLE_SPLIT_PMD_PTLOCK |
| 575 | bool | 576 | bool |