Skip to content

Remove incorrect host mincore call and add rodata handling

Benjamin Berg linux-um llvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2um: mark rodata read-only and implement _nofault accessesarch/um/Kconfig arch/um/include/asm/processor-generic.h arch/um/include/asm/uaccess.h +12 more+108 -234 replies
2/2um: remove copy_from_kernel_nofault_allowedarch/um/include/shared/os.h arch/um/kernel/Makefile arch/um/kernel/maccess.c +1 more+1 -720 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Remove incorrect host mincore call and add rodata handling

From: Benjamin Berg <[email protected]>

Hi,

using mincore() to check whether a page is owned by UML is not correct as it returns whether the page is resident in memory and not whether something has been mapped at the address. This means that UML could get spurious failures in *_nofault functions like copy_from_kernel_nofault).

If this happens, it can create hard to debug issues. For us the problem showed up because hostfs was randomly throwing ENOENT errors when loading libraries (including ld.so). This can be traced back to dentry_path_raw failing as it uses an optimization that requires the use of copy_from_kernel_nofault internally (see the documentation of prepend_name and prepend_copy).

Pull in the existing RODATA patch from Johannes (with light editing) and then remove the call to mincore() as it is incorrect.

Benjamin

Benjamin Berg (1):
um: remove copy_from_kernel_nofault_allowed

Johannes Berg (1):
um: mark rodata read-only and implement _nofault accesses

 arch/um/Kconfig                          |  1 +
 arch/um/include/asm/processor-generic.h  |  2 +
 arch/um/include/asm/uaccess.h            | 20 +++++++---
 arch/um/include/shared/arch.h            |  2 +
 arch/um/include/shared/as-layout.h       |  2 +-
 arch/um/include/shared/irq_user.h        |  3 +-
 arch/um/include/shared/kern_util.h       | 12 ++++--
 arch/um/include/shared/os.h              |  1 -
 arch/um/kernel/Makefile                  |  2 +-
 arch/um/kernel/irq.c                     |  3 +-
 arch/um/kernel/maccess.c                 | 19 ---------
 arch/um/kernel/mem.c                     | 10 +++++
 arch/um/kernel/trap.c                    | 28 ++++++++++---
 arch/um/os-Linux/process.c               | 51 ------------------------
 arch/um/os-Linux/signal.c                |  4 +-
 arch/um/os-Linux/skas/process.c          |  8 ++--
 arch/x86/um/os-Linux/mcontext.c          | 12 ++++++
 arch/x86/um/shared/sysdep/faultinfo_32.h | 12 ++++++
 arch/x86/um/shared/sysdep/faultinfo_64.h | 12 ++++++
 19 files changed, 109 insertions(+), 95 deletions(-)
 delete mode 100644 arch/um/kernel/maccess.c
Signature · 1 line
2.48.1