A single fix for _nofault infrastructure.

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEpeA8sTs3M8SN2hR410qiO8sPaAAFAmgYczkACgkQ10qiO8sP
 aABYZQ/+KwKJgXa0fJokE4n2pAqTs1m/2j8ss8Czzj14Ei75tymXLO4qAa6l7Xg/
 2zl+j0AO2wCJmwbUdKhXMgo2VUCGff1pN/lHcdYTl4Q59bblZmAoyViI7VbgTztP
 7DkCdwq0FcZXFcnDrgMaq2CzRlo9ZQ1RXEJtLuoy0YP2d0umfPEGdgmQciJXuCWg
 beRza9m1kjJCumVM9hOll2N72oKxOmy7WxVDTiwXZO20U8mfjT4VpjL13usZm5X6
 ho3s94ULgAeklTwJD/ZO01Msa11Zy/b7pWew8RNcs/0yWP1UqkU1e3GXjzof/xDq
 70NgO5sUO2zz9uCg4CD3sViJdDV2Z7yz7pYmIXtTufkegvJ0uvrsQuwK3qXFYNaT
 4anQRq8SMue+puFnGWBJT3LwnLJUlqr6Xb5GvlU4NJtnAEPDn8wZ9MIJRnmp8gY/
 uOtfRqUxecW1zcqt0ZUpeVFdzWbFREIUdm2dwIZN6Ks5avkvx3E6kDlciMx7TrG1
 dVW2DqXIimXGDMq0M9iKAYqDlySh7O+nql1/NaXSYbY1qOfx4jf5gUEjHMd1KwdF
 T9JhrPyOENEVc2QBSI21L3n4bFV8cLbbWQdnQw6EmdGp/8fAsFtMp/ArRaNnjtg0
 GinPWpZeK3KSjlHsgKTyegtOTREEtqW+G5i551Tk7DOft5IWlNs=
 =CcCu
 -----END PGP SIGNATURE-----

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

Pull uml fix from Johannes Berg:
 "There's just a single fix here for the _nofault changes that were
  causing issues with clang, and then when we looked at it some other
  issues seemed to exist"

* tag 'uml-for-linux-6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
  um: fix _nofault accesses
pull/1220/head
Linus Torvalds 2025-05-05 08:14:53 -07:00
commit 01f95500a1
4 changed files with 17 additions and 15 deletions

View File

@ -55,6 +55,7 @@ do { \
goto err_label; \
} \
*((type *)dst) = get_unaligned((type *)(src)); \
barrier(); \
current->thread.segv_continue = NULL; \
} while (0)
@ -66,6 +67,7 @@ do { \
if (__faulted) \
goto err_label; \
put_unaligned(*((type *)src), (type *)(dst)); \
barrier(); \
current->thread.segv_continue = NULL; \
} while (0)

View File

@ -225,20 +225,20 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
panic("Failed to sync kernel TLBs: %d", err);
goto out;
}
else if (current->mm == NULL) {
if (current->pagefault_disabled) {
if (!mc) {
show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault with pagefaults disabled but no mcontext");
}
if (!current->thread.segv_continue) {
show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault without recovery target");
}
mc_set_rip(mc, current->thread.segv_continue);
current->thread.segv_continue = NULL;
goto out;
else if (current->pagefault_disabled) {
if (!mc) {
show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault with pagefaults disabled but no mcontext");
}
if (!current->thread.segv_continue) {
show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault without recovery target");
}
mc_set_rip(mc, current->thread.segv_continue);
current->thread.segv_continue = NULL;
goto out;
}
else if (current->mm == NULL) {
show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault with no mm");
}

View File

@ -31,8 +31,8 @@ struct faultinfo {
#define ___backtrack_faulted(_faulted) \
asm volatile ( \
"mov $0, %0\n" \
"movl $__get_kernel_nofault_faulted_%=,%1\n" \
"mov $0, %0\n" \
"jmp _end_%=\n" \
"__get_kernel_nofault_faulted_%=:\n" \
"mov $1, %0;" \

View File

@ -31,8 +31,8 @@ struct faultinfo {
#define ___backtrack_faulted(_faulted) \
asm volatile ( \
"mov $0, %0\n" \
"movq $__get_kernel_nofault_faulted_%=,%1\n" \
"mov $0, %0\n" \
"jmp _end_%=\n" \
"__get_kernel_nofault_faulted_%=:\n" \
"mov $1, %0;" \