Re: [PATCH 1/2] um: mark rodata read-only and implement _nofault accesses

2025-04-05 Thread Nathan Chancellor
Hi Benjamin and Johannes, On Mon, Feb 10, 2025 at 05:09:25PM +0100, Benjamin Berg wrote: > From: Johannes Berg > > Mark read-only data actually read-only (simple mprotect), and > to be able to test it also implement _nofault accesses. This > works by setting up a new "segv_continue" pointer in c

Re: [PATCH] um: fix _nofault accesses

2025-04-04 Thread Nathan Chancellor
rue kernel tasks, but we could do this for a > userspace task, so the current->thread.segv_continue logic must > be lifted out of the mm==NULL check. > > Finally, while looking at this, put a barrier() so the NULL > assignment to thread.segv_continue cannot be reorder before > the

Re: [PATCH 1/2] um: mark rodata read-only and implement _nofault accesses

2025-04-03 Thread Nathan Chancellor
On Thu, Apr 03, 2025 at 08:20:23AM +0200, Benjamin Berg wrote: > Hi Nathan, > > oops, that is a little logic bug in the code. When we are coming from > userspace, we may be running as part of a user task and have an mm. And > then the new "current->pagefault_disabled" logic is skipped. So when > p

Re: [PATCH v2 0/4] Enable measuring the kernel's Source-based Code Coverage and MC/DC with Clang

2024-11-22 Thread Nathan Chancellor
; On 10/3/24 6:29 PM, Nathan Chancellor wrote: > > I seem to have narrowed down it to a few different configurations on top > > of x86_64_defconfig but I will include the full bad configuration as an > > attachment just in case anything else is relevant. > >

Re: [PATCH v2 0/4] Enable measuring the kernel's Source-based Code Coverage and MC/DC with Clang

2024-11-22 Thread Nathan Chancellor
On Fri, Nov 22, 2024 at 01:27:03PM +0100, Peter Zijlstra wrote: > On Thu, Oct 03, 2024 at 04:29:38PM -0700, Nathan Chancellor wrote: > > > $ /usr/bin/time -v make -skj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper > > {def,amd_mem_encrypt.,fortify_source.,llvm_cov.}config b

Re: [PATCH v7 6/8] x86/module: prepare module loading for ROX allocations of text

2024-11-05 Thread Nathan Chancellor
ed, I think we are all good here. Tested-by: Nathan Chancellor > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c > index 3407efc26528..243843e44e89 100644 > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -124

Re: [PATCH v7 6/8] x86/module: prepare module loading for ROX allocations of text

2024-11-04 Thread Nathan Chancellor
Hi Mike, On Wed, Oct 23, 2024 at 07:27:09PM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > When module text memory will be allocated with ROX permissions, the > memory at the actual address where the module will live will contain > invalid instructions and there will be a wr

Re: [PATCH] um: fix stub exe build with CONFIG_GCOV

2024-10-27 Thread Nathan Chancellor
less chance of any > conflicts. > > Reported-by: kernel test robot > Closes: > https://lore.kernel.org/oe-kbuild-all/202410242238.sxhs2kq4-...@intel.com/ > Fixes: 32e8eaf263d9 ("um: use execveat to create userspace MMs") > Signed-off-by: Johannes Berg Review

Re: [PATCH v6 6/8] x86/module: prepare module loading for ROX allocations of text

2024-10-21 Thread Nathan Chancellor
Hi Mike, On Wed, Oct 16, 2024 at 03:24:22PM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > When module text memory will be allocated with ROX permissions, the > memory at the actual address where the module will live will contain > invalid instructions and there will be a wr

[PATCH 1/2] um: Fix passing '-n' to linker for stub_exe

2024-10-16 Thread Nathan Chancellor
'--nmagic', so prefix it with '-Wl,'. Fixes: 32e8eaf263d9 ("um: use execveat to create userspace MMs") Signed-off-by: Nathan Chancellor --- arch/um/kernel/skas/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/

[PATCH 0/2] um: Fix a couple of issues with stub_exe when building with clang

2024-10-16 Thread Nathan Chancellor
This series fixes a couple of issues I see when building ARCH=um defconfig with LLVM=1 after commit 32e8eaf263d9 ("um: use execveat to create userspace MMs") in -next. This passes my basic build and boot testing with both GCC and clang. --- Nathan Chancellor (2): um: Fix passi

[PATCH 2/2] um: Disable auto variable initialization for stub_exe.c

2024-10-16 Thread Nathan Chancellor
reate userspace MMs") Signed-off-by: Nathan Chancellor --- arch/um/kernel/skas/Makefile | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile index f93db893b8236cf805edd01b41501d51dd8f0a35..f6a219074772283f3c6c6d8d6ccaa8a1cfc24e33 1

Re: [PATCH v9 02/10] um: use execveat to create userspace MMs

2024-10-15 Thread Nathan Chancellor
Hi Benjamin, On Thu, Sep 19, 2024 at 02:45:03PM +0200, Benjamin Berg wrote: ... > diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile > index 6f86d53e3d69..fbb61968055f 100644 > --- a/arch/um/kernel/skas/Makefile > +++ b/arch/um/kernel/skas/Makefile > @@ -3,14 +3,43 @@ > # Co

Re: [PATCH v5 6/8] x86/module: perpare module loading for ROX allocations of text

2024-10-15 Thread Nathan Chancellor
On Fri, Oct 11, 2024 at 03:58:04PM +0300, Mike Rapoport wrote: > I overlooked how cfi_*_callers routines update addr. > This patch should fix it: Thanks, can confirm. My boot is working again and LKDTM's CFI_FORWARD_PROTO test properly fails. > diff --git a/arch/x86/kernel/alternative.c b/arch/x8

Re: [PATCH v5 6/8] x86/module: perpare module loading for ROX allocations of text

2024-10-10 Thread Nathan Chancellor
Hi Mike, On Wed, Oct 09, 2024 at 09:08:14PM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > When module text memory will be allocated with ROX permissions, the > memory at the actual address where the module will live will contain > invalid instructions and there will be a wr

Re: [PATCH v2 0/4] Enable measuring the kernel's Source-based Code Coverage and MC/DC with Clang

2024-10-01 Thread Nathan Chancellor
Hi Wentao, I took this series for a spin on next-20241001 with LLVM 19.1.0 using a distribution configuration tailored for a local development VM using QEMU. You'll notice on the rebase for 6.12-rc1 but there is a small conflict in kernel/Makefile due to commit 0e8b67982b48 ("mm: move kernel/numa.

Re: [PATCH v2 2/4] llvm-cov: add Clang's MC/DC support

2024-10-01 Thread Nathan Chancellor
49/sej.1994.0025 [2] > Link: > https://discourse.llvm.org/t/rfc-coverage-new-algorithm-and-file-format-for-mc-dc/76798 > [3] > Link: > https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#mc-dc-instrumentation > [4] Thank you for using this link format :) > Signed-off-

Re: [PATCH v2 4/4] x86: enable llvm-cov support

2024-10-01 Thread Nathan Chancellor
> > Signed-off-by: Wentao Zhang > Reviewed-by: Chuck Wolber > Tested-by: Chuck Wolber Reviewed-by: Nathan Chancellor > --- > arch/x86/Kconfig | 2 ++ > arch/x86/kernel/vmlinux.lds.S | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git

Re: [PATCH v2 3/4] x86: disable llvm-cov instrumentation

2024-10-01 Thread Nathan Chancellor
ed with gcov as well. See c390c452ebeb ("crypto: > x86/curve25519 - disable gcov"). > > Signed-off-by: Wentao Zhang > Reviewed-by: Chuck Wolber > Tested-by: Chuck Wolber Reviewed-by: Nathan Chancellor > --- > arch/x86/crypto/Makefile | 3 ++- > 1 file changed

Re: [PATCH v2 1/4] llvm-cov: add Clang's Source-based Code Coverage support

2024-10-01 Thread Nathan Chancellor
heckpatch.pl (I didn't check). The Kbuild bits look good as well, they match the gcov implementation. As most of my comments are more nits than anything else, feel free to carry this over: Reviewed-by: Nathan Chancellor > diff --git a/kernel/llvm-cov/Kconfig b/kernel/llvm-cov/Kconfig

Re: [PATCH v2 1/4] mm: Add optional close() to struct vm_special_mapping

2024-08-19 Thread Nathan Chancellor
On Mon, Aug 19, 2024 at 12:29:34PM -0700, Linus Torvalds wrote: > On Mon, 19 Aug 2024 at 11:53, Nathan Chancellor wrote: > > > > > > Modules linked in: > > Pid: 24, comm: mount Not tainted 6.11.0-rc4-next-20240819 > > RIP: 0033:0x68006f6c > > RSP: 000

Re: [PATCH v2 1/4] mm: Add optional close() to struct vm_special_mapping

2024-08-19 Thread Nathan Chancellor
Hi Michael, On Mon, Aug 12, 2024 at 06:26:02PM +1000, Michael Ellerman wrote: > Add an optional close() callback to struct vm_special_mapping. It will > be used, by powerpc at least, to handle unmapping of the VDSO. > > Although support for unmapping the VDSO was initially added > for CRIU[1], it

Re: Crash when booting UML after e3c92e81711d14b46c3121d36bc8e152cb843923

2024-07-16 Thread Nathan Chancellor
On Tue, Jul 16, 2024 at 05:41:14PM -0700, Linus Torvalds wrote: > On Tue, 16 Jul 2024 at 16:18, Linus Torvalds > wrote: > > > > Hmm... Does this simple (whitespace-damaged) patch fix it for you? > > I verified that it seemed to generate the right (generic) code, so > I've committed this fix. I di

Crash when booting UML after e3c92e81711d14b46c3121d36bc8e152cb843923

2024-07-16 Thread Nathan Chancellor
Hi Linus, Our continuous integration notices a crash when booting User Mode Linux after commit e3c92e81711d ("runtime constants: add x86 architecture support"), which I've distilled down to: $ make -skj"$(nproc)" ARCH=um CROSS_COMPILE=x86_64-linux- defconfig linux $ curl -LSs https://github.com

[PATCH] hostfs: Add const qualifier to host_root in hostfs_fill_super()

2024-06-11 Thread Nathan Chancellor
verse Christmas tree order intact. Fixes: cd140ce9f611 ("hostfs: convert hostfs to use the new mount API") Signed-off-by: Nathan Chancellor --- fs/hostfs/hostfs_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index

Re: [PATCH] arch: um: rust: Add i386 support for Rust

2024-06-04 Thread Nathan Chancellor
Hi David, Just a fly by comment on style, I don't have much to say content :) On Wed, Jun 05, 2024 at 06:40:50AM +0800, David Gow wrote: > At present, Rust in the kernel only supports 64-bit x86, so UML has > followed suit. However, it's significantly easier to support 32-bit i386 > on UML than o

[PATCH 2/2] modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS

2024-01-23 Thread Nathan Chancellor
with '-mcmodel=large', which ARCH=um uses. These sections should be handled just as '.text' and '.text.*' are, so add them to TEXT_SECTIONS. Cc: sta...@vger.kernel.org Closes: https://github.com/ClangBuiltLinux/linux/issues/1981 Link: https://github.com/llvm/llvm-pr

[PATCH 1/2] um: Fix adding '-no-pie' for clang

2024-01-23 Thread Nathan Chancellor
e' with CONFIG_LD_SCRIPT_DYN=y, so that it is enabled with all compilers that support this. Furthermore, using gcc-min-version can help turn this back into LINK-$(CONFIG_LD_SCRIPT_DYN) += -no-pie when the minimum version of GCC is bumped past 6.1.0. Cc: sta...@vger.kernel.org Closes: http

[PATCH 0/2] Fix UML build with clang-18 and newer

2024-01-23 Thread Nathan Chancellor
ntation fault with modpost. I have tested these patches with all supported versions of clang, noticing no regressions. --- Nathan Chancellor (2): um: Fix adding '-no-pie' for clang modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS arch/um/Makefil

Re: [PATCH] um: net: Fix return type of uml_net_start_xmit()

2023-12-06 Thread Nathan Chancellor
On Wed, Dec 06, 2023 at 07:19:35AM +, Anton Ivanov wrote: > > > On 05/12/2023 17:53, Nathan Chancellor wrote: > > Ping? I would like to turn this warning on for W=1 and the kbuild test > > robot flagged this instance. If the UML folks don't want to carry it, > &g

[PATCH v2 0/2] Enable -Wincompatible-function-pointer-types-strict under W=1

2023-12-06 Thread Nathan Chancellor
002-enable-wincompatible-function-pointer-types-strict-w-1-v1-1-808ab955d...@kernel.org --- Nathan Chancellor (2): um: net: Fix return type of uml_net_start_xmit() kbuild: Enable -Wincompatible-function-pointer-types-strict in W=1 arch/um/drivers/net_kern.c | 2 +- scripts/Makefile.extrawar

[PATCH v2 1/2] um: net: Fix return type of uml_net_start_xmit()

2023-12-06 Thread Nathan Chancellor
currently implement support for kCFI, it could in the future, which means this warning becomes a fatal CFI failure at run time. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310031340.v1vph207-...@intel.com/ Acked-by: Anton Ivanov Signed-off-by: Nathan Chan

Re: [PATCH] um: net: Fix return type of uml_net_start_xmit()

2023-12-05 Thread Nathan Chancellor
ction-pointer-types-strict-w-1-v1-1-808ab955d...@kernel.org/ On Tue, Oct 03, 2023 at 11:35:53AM -0700, Nathan Chancellor wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to

Re: [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets

2023-10-09 Thread Nathan Chancellor
On Mon, Oct 09, 2023 at 09:42:10PM +0900, Masahiro Yamada wrote: > Now that vdso_install does not depend on any in-tree build artifact, > it no longer invokes a compiler, making no-compiler-targets the same > as no-sync-config-targets. > > Signed-off-by: Masahiro Yamada > --- > > Makefile | 13

[PATCH] um: net: Fix return type of uml_net_start_xmit()

2023-10-03 Thread Nathan Chancellor
currently implement support for kCFI, it could in the future, which means this warning becomes a fatal CFI failure at run time. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202310031340.v1vph207-...@intel.com/ Signed-off-by: Nathan Chancellor --- arch/um/drive

Re: [PATCH v2] asm goto: eradicate CC_HAS_ASM_GOTO

2022-08-19 Thread Nathan Chancellor
Suggested-by: Masahiro Yamada > Suggested-by: Alexei Starovoitov > Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor > --- > > Changes v1 -> v2: > https://lore.kernel.org/linux-kbuild/20220819170053.2686006-1-ndesaulni...@google.com/ > * Pick up Boris' a

Re: [PATCH 1/1] um: fix error return code in winch_tramp()

2022-05-20 Thread Nathan Chancellor
On Fri, May 20, 2022 at 07:18:28PM +0200, Johannes Berg wrote: > On Fri, 2022-05-20 at 08:55 -0700, Nathan Chancellor wrote: > > On Fri, May 20, 2022 at 08:08:01AM +0200, Thorsten Leemhuis wrote: > > > On 11.04.22 20:45, Richard Weinberger wrote: > > >

Re: [PATCH 1/1] um: fix error return code in winch_tramp()

2022-05-20 Thread Nathan Chancellor
On Fri, May 20, 2022 at 08:08:01AM +0200, Thorsten Leemhuis wrote: > On 11.04.22 20:45, Richard Weinberger wrote: > > - Ursprüngliche Mail - > >> Von: "Nathan Chancellor" > >> I attempted to print out the error code but it seems like there is no >

Re: [PATCH v3 00/15] kbuild: yet another series of cleanups (modpost, LTO, MODULE_REL_CRCS)

2022-05-06 Thread Nathan Chancellor
ment error I merged this series into mainline and tested an Arch Linux x86_64 configuration and Fedora aarch64 configuration with ThinLTO and saw no new warnings or issues. Modules loaded just fine in QEMU for Arch Linux and I did not notice any boot issues or warnings. Tested-by: Nathan Chancellor Che

Re: [PATCH 1/1] um: fix error return code in winch_tramp()

2022-04-11 Thread Nathan Chancellor
nto most of them and lack > > knowledge about most of the areas they concern. I thus unfortunately > > will sometimes get things wrong or miss something important. I hope > > that's not the case here; if you think it is, don't hesitate to tell me > &

Re: [PATCH 1/2] kbuild: Remove '-mno-global-merge'

2022-03-31 Thread Nathan Chancellor
On Thu, Mar 31, 2022 at 09:11:12AM +0200, Sedat Dilek wrote: > On Thu, Mar 31, 2022 at 5:27 AM Nathan Chancellor wrote: > > > > This flag is specific to clang, where it is only used by the 32-bit and > > 64-bit ARM backends. In certain situations, the presence of this

[PATCH 2/2] Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"

2022-03-30 Thread Nathan Chancellor
ned-off-by: Nathan Chancellor --- arch/um/Makefile | 4 1 file changed, 4 deletions(-) diff --git a/arch/um/Makefile b/arch/um/Makefile index 320b09cd513c..f2fe63bfd819 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -75,10 +75,6 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(pa

[PATCH 0/2] Remove '-mno-global-merge' from KBUILD_CFLAGS

2022-03-30 Thread Nathan Chancellor
r/20220322173547.677760-1-nat...@kernel.org/ [3]: https://github.com/llvm/llvm-project/commit/863bfdbfb446adaef767ff514d1f2ffb5d489562 Nathan Chancellor (2): kbuild: Remove '-mno-global-merge' Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS" Makefile

[PATCH 1/2] kbuild: Remove '-mno-global-merge'

2022-03-30 Thread Nathan Chancellor
f the removal of this flag, it can be added back under arch/arm{,64}/Makefile to avoid warnings on other architectures. Signed-off-by: Nathan Chancellor --- Makefile | 4 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index daeb5c88b50b..f2723d9bfca4 100644 --- a/Make

Re: [PATCH] um: Fix filtering '-mno-global-merge'

2022-03-26 Thread Nathan Chancellor
On Sat, Mar 26, 2022 at 12:29:55PM +0900, Masahiro Yamada wrote: > On Wed, Mar 23, 2022 at 2:39 AM Nathan Chancellor wrote: > > > > When booting a clang compiled UML kernel, the kernel panics when trying > > to run init: > > > > wait_stub_done : failed to

Re: [PATCH 1/1] um: fix error return code in winch_tramp()

2022-03-23 Thread Nathan Chancellor
Hello, On Sat, May 08, 2021 at 11:22:39AM +0800, Zhen Lei wrote: > Fix to return a negative error code from the error handling case instead > of 0, as done elsewhere in this function. > > Fixes: 89df6bfc0405 ("uml: DEBUG_SHIRQ fixes") > Reported-by: Hulk Robot > Signed-off-by: Zhen Lei > --- >

[PATCH] um: Fix filtering '-mno-global-merge'

2022-03-22 Thread Nathan Chancellor
USER_CFLAGS properly, which resolves the boot issue noted above. Fixes: 6580c5c18fb3 ("um: clang: Strip out -mno-global-merge from USER_CFLAGS") Signed-off-by: Nathan Chancellor --- arch/um/Makefile | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch

Re: [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS

2022-03-03 Thread Nathan Chancellor
On Thu, Mar 03, 2022 at 10:04:28AM -0800, Kees Cook wrote: > On Thu, Mar 03, 2022 at 10:30:47AM -0700, Nathan Chancellor wrote: > > Hi David, > > > > On Thu, Mar 03, 2022 at 05:06:42PM +0800, David Gow wrote: > > > The things built with USER_CFLAGS don't seem

Re: [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS

2022-03-03 Thread Nathan Chancellor
ing regular kernel builds, maybe something about how UML objects are compiled exposes this? Regardless, I would definitely like to clean up this instance of the warning because I would like to make this warning a hard error so that we do not get cryptic cc-option failures: https://github.com/C