Skip to content

Commit 065c4e6

Browse files
committed
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
2 parents b66cb4f + 6522fe5 commit 065c4e6

12 files changed

Lines changed: 33 additions & 16 deletions

File tree

arch/um/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ config UML
1111
select ARCH_HAS_CACHE_LINE_SIZE
1212
select ARCH_HAS_CPU_FINALIZE_INIT
1313
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)
1517
select ARCH_HAS_KCOV
1618
select ARCH_HAS_STRNCPY_FROM_USER
1719
select ARCH_HAS_STRNLEN_USER

arch/um/configs/x86_64_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@ CONFIG_PROC_KCORE=y
6060
CONFIG_TMPFS=y
6161
CONFIG_NLS=y
6262
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
63-
CONFIG_FRAME_WARN=1024
6463
CONFIG_DEBUG_KERNEL=y

arch/um/drivers/cow_user.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
#include "cow.h"
1616
#include "cow_sys.h"
1717

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+
1824
#define PATH_LEN_V1 256
1925

2026
/* unsigned time_t works until year 2106 */
@@ -153,7 +159,7 @@ static int absolutize(char *to, int size, char *from)
153159
errno);
154160
return -1;
155161
}
156-
slash = strrchr(from, '/');
162+
slash = kernel_strrchr(from, '/');
157163
if (slash != NULL) {
158164
*slash = '\0';
159165
if (chdir(from)) {

arch/um/include/asm/pgtable.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,12 @@ static inline int pte_none(pte_t pte)
112112
*/
113113
static inline int pte_read(pte_t pte)
114114
{
115-
return((pte_get_bits(pte, _PAGE_USER)) &&
116-
!(pte_get_bits(pte, _PAGE_PROTNONE)));
115+
return !pte_get_bits(pte, _PAGE_PROTNONE);
117116
}
118117

119-
static inline int pte_exec(pte_t pte){
120-
return((pte_get_bits(pte, _PAGE_USER)) &&
121-
!(pte_get_bits(pte, _PAGE_PROTNONE)));
118+
static inline int pte_exec(pte_t pte)
119+
{
120+
return !pte_get_bits(pte, _PAGE_PROTNONE);
122121
}
123122

124123
static inline int pte_write(pte_t pte)

arch/um/kernel/skas/stub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ stub_signal_interrupt(int sig, siginfo_t *info, void *p)
146146
/* Receive the FDs */
147147
num_fds = 0;
148148
fd_msg = msghdr.msg_control;
149-
fd_map = (void *)&CMSG_DATA(fd_msg);
149+
fd_map = (void *)CMSG_DATA(fd_msg);
150150
if (res == iov.iov_len && msghdr.msg_controllen > sizeof(struct cmsghdr))
151151
num_fds = (fd_msg->cmsg_len - CMSG_LEN(0)) / sizeof(int);
152152

arch/um/kernel/skas/uaccess.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ static int strncpy_chunk_from_user(unsigned long from, int len, void *arg)
170170
char **to_ptr = arg, *to = *to_ptr;
171171
int n;
172172

173-
strncpy(to, (void *) from, len);
174-
n = strnlen(to, len);
173+
n = strnlen((void *) from, len);
174+
memcpy_and_pad(to, len, (void *) from, n, 0);
175175
*to_ptr += n;
176176

177177
if (n < len)

arch/um/kernel/tlb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ static int kern_map(struct mm_id *mm_idp,
2929
unsigned long virt, unsigned long len, int prot,
3030
int phys_fd, unsigned long long offset)
3131
{
32-
/* TODO: Why is executable needed to be always set in the kernel? */
3332
return os_map_memory((void *)virt, phys_fd, offset, len,
3433
prot & UM_PROT_READ, prot & UM_PROT_WRITE,
35-
1);
34+
prot & UM_PROT_EXEC);
3635
}
3736

3837
static int kern_unmap(struct mm_id *mm_idp,
@@ -165,6 +164,7 @@ int um_tlb_sync(struct mm_struct *mm)
165164
unsigned long addr, next;
166165
int ret = 0;
167166

167+
guard(spinlock_irqsave)(&mm->page_table_lock);
168168
guard(spinlock_irqsave)(&mm->context.sync_tlb_lock);
169169

170170
if (mm->context.sync_tlb_range_to == 0)

arch/x86/Makefile.um

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,6 @@ ELF_FORMAT := elf64-x86-64
6060
LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib64
6161
LINK-y += -m64
6262

63+
vdso-install-y += arch/x86/um/vdso/vdso.so.dbg
64+
6365
endif

arch/x86/um/os-Linux/mcontext.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
#include <linux/string.h>
55
#include <sys/ucontext.h>
66
#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
712
#include <asm/sigcontext.h>
13+
#undef sigcontext
814
#include <sysdep/ptrace.h>
915
#include <sysdep/mcontext.h>
1016
#include <arch.h>

arch/x86/um/vdso/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Building vDSO images for x86.
44
#
55

6-
vdso-install-y += vdso.so
7-
86
# files to link into the vdso
97
vobjs-y := vdso-note.o um_vdso.o
108

0 commit comments

Comments
 (0)