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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEpeA8sTs3M8SN2hR410qiO8sPaAAFAmnmKS4ACgkQ10qiO8sP
 aAD2+w//dOOblgUYgQJUXIxHpS7Gcb3Tm+a7ujC23q/kWf/pc8milCSf+zoxzUXL
 23Vwh4Gt4KrHKp8lG1gU3xZqV0qwhXNi5HO2hMpB0ioIVpX3TcrUhFbp/Oirvhgi
 3PvnvsFtUlW82DFgewB98tefXZSAlG/pg+RjQ3weHfEo+xQbjYc+kR8o59tN8LNR
 Ea4rrxyjsr3KN2yBNaFpDkMchudP6XWgKByAZBxZ2FofC3zuVRCyF8ThDfQl/3/W
 muSqX+2iuKjGpmxV0XWt72hYOhNYjBtDY7f4EPe6sbUy+PU6SjD9h/s7VTyVHgZR
 3Sii9AQLLJNYPoglExMfmWfeUnJCUJNNTLUze+ZtnhURZQYTvyJRzVmKj6fDPjK2
 jGEKXanfZCK9Cfgy2f2xbQxCxhAVwz6QT0XaQO2dZBXa0anzG+2HM0Zn8MNa9jbU
 +Lm11k1jd1QBifr+5zeni98KHt2mf77blCny8TraODgLNgWUVi5kMkPF4bZgD4Qj
 udMU9lOkTD08R89hG/Le9TsB+NIpPauyNxDHUpC/VDterFdZqFvmOFT6afTo/4RZ
 nXNVdL1tn+7O7v0bLdbyhXwj2her1GDbe6HZ5eTNqmjcOthcgI3gF2stDfFhEbNb
 /wMHnpGPncMeEI8YWtWOFA4FA5T32+LafLCKhuRJdaw0+f/NMOo=
 =oovZ
 -----END PGP SIGNATURE-----

Merge tag 'uml-for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux

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
This commit is contained in:
Linus Torvalds 2026-04-20 16:36:46 -07:00
commit 065c4e67cc
12 changed files with 33 additions and 16 deletions

View File

@ -11,7 +11,9 @@ config UML
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_CPU_FINALIZE_INIT
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
# Clang 20 & 21 miscompute __builtin_object_size() under -fprofile-arcs
# on 32-bit, causing spurious compile-time errors in check_copy_size().
select ARCH_HAS_GCOV_PROFILE_ALL if !(!64BIT && CLANG_VERSION >= 200000 && CLANG_VERSION < 220100)
select ARCH_HAS_KCOV
select ARCH_HAS_STRNCPY_FROM_USER
select ARCH_HAS_STRNLEN_USER

View File

@ -60,5 +60,4 @@ CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
CONFIG_NLS=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_FRAME_WARN=1024
CONFIG_DEBUG_KERNEL=y

View File

@ -15,6 +15,12 @@
#include "cow.h"
#include "cow_sys.h"
/*
* arch/um/Makefile remaps strrchr to kernel_strrchr; call the kernel
* name directly to avoid glibc >= 2.43's C23 strrchr macro.
*/
char *kernel_strrchr(const char *, int);
#define PATH_LEN_V1 256
/* unsigned time_t works until year 2106 */
@ -153,7 +159,7 @@ static int absolutize(char *to, int size, char *from)
errno);
return -1;
}
slash = strrchr(from, '/');
slash = kernel_strrchr(from, '/');
if (slash != NULL) {
*slash = '\0';
if (chdir(from)) {

View File

@ -112,13 +112,12 @@ static inline int pte_none(pte_t pte)
*/
static inline int pte_read(pte_t pte)
{
return((pte_get_bits(pte, _PAGE_USER)) &&
!(pte_get_bits(pte, _PAGE_PROTNONE)));
return !pte_get_bits(pte, _PAGE_PROTNONE);
}
static inline int pte_exec(pte_t pte){
return((pte_get_bits(pte, _PAGE_USER)) &&
!(pte_get_bits(pte, _PAGE_PROTNONE)));
static inline int pte_exec(pte_t pte)
{
return !pte_get_bits(pte, _PAGE_PROTNONE);
}
static inline int pte_write(pte_t pte)

View File

@ -146,7 +146,7 @@ stub_signal_interrupt(int sig, siginfo_t *info, void *p)
/* Receive the FDs */
num_fds = 0;
fd_msg = msghdr.msg_control;
fd_map = (void *)&CMSG_DATA(fd_msg);
fd_map = (void *)CMSG_DATA(fd_msg);
if (res == iov.iov_len && msghdr.msg_controllen > sizeof(struct cmsghdr))
num_fds = (fd_msg->cmsg_len - CMSG_LEN(0)) / sizeof(int);

View File

@ -170,8 +170,8 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
char **to_ptr = arg, *to = *to_ptr;
int n;
strncpy(to, (void *) from, len);
n = strnlen(to, len);
n = strnlen((void *) from, len);
memcpy_and_pad(to, len, (void *) from, n, 0);
*to_ptr += n;
if (n < len)

View File

@ -29,10 +29,9 @@ static int kern_map(struct mm_id *mm_idp,
unsigned long virt, unsigned long len, int prot,
int phys_fd, unsigned long long offset)
{
/* TODO: Why is executable needed to be always set in the kernel? */
return os_map_memory((void *)virt, phys_fd, offset, len,
prot & UM_PROT_READ, prot & UM_PROT_WRITE,
1);
prot & UM_PROT_EXEC);
}
static int kern_unmap(struct mm_id *mm_idp,
@ -165,6 +164,7 @@ int um_tlb_sync(struct mm_struct *mm)
unsigned long addr, next;
int ret = 0;
guard(spinlock_irqsave)(&mm->page_table_lock);
guard(spinlock_irqsave)(&mm->context.sync_tlb_lock);
if (mm->context.sync_tlb_range_to == 0)

View File

@ -60,4 +60,6 @@ ELF_FORMAT := elf64-x86-64
LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64
LINK-y += -m64
vdso-install-y += arch/x86/um/vdso/vdso.so.dbg
endif

View File

@ -4,7 +4,13 @@
#include <linux/string.h>
#include <sys/ucontext.h>
#include <asm/ptrace.h>
/*
* musl defines struct sigcontext in <bits/signal.h>. Rename the kernel's
* copy to avoid redefinition while keeping the FP-state types available.
*/
#define sigcontext __kernel_sigcontext
#include <asm/sigcontext.h>
#undef sigcontext
#include <sysdep/ptrace.h>
#include <sysdep/mcontext.h>
#include <arch.h>

View File

@ -3,8 +3,6 @@
# Building vDSO images for x86.
#
vdso-install-y += vdso.so
# files to link into the vdso
vobjs-y := vdso-note.o um_vdso.o

View File

@ -56,6 +56,9 @@ enum um_timetravel_shared_mem_fds {
* in the control message
*/
UM_TIMETRAVEL_SHARED_LOGFD,
/**
* @UM_TIMETRAVEL_SHARED_MAX_FDS: number of fds listed here
*/
UM_TIMETRAVEL_SHARED_MAX_FDS,
};
@ -242,6 +245,7 @@ union um_timetravel_schedshm_client {
__u64 req_time;
__u64 name;
};
/* private: */
char reserve[128]; /* reserved for future usage */
};
@ -264,7 +268,7 @@ union um_timetravel_schedshm_client {
* is made by any client. Clients also must update this value when they
* insert/update an own request into the shared memory while not running
* themselves, and the new request is before than the current value.
* current_time: Current time, can only be set by the client in running state
* @current_time: Current time, can only be set by the client in running state
* (indicated by @running_id), though that client may only run until @free_until,
* so it must remain smaller than @free_until.
* @running_id: The current client in state running, set before a client is

View File

@ -570,6 +570,7 @@ config SPLIT_PTE_PTLOCKS
depends on !ARM || CPU_CACHE_VIPT
depends on !PARISC || PA20
depends on !SPARC32
depends on !UML
config ARCH_ENABLE_SPLIT_PMD_PTLOCK
bool