linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/Kconfig: Allow X86_X32_ABI with llvm-objcopy in some cases
       [not found] <20220701210437.579322-1-alex_y_xu.ref@yahoo.ca>
@ 2022-07-01 21:04 ` Alex Xu (Hello71)
  2022-07-01 21:20   ` Nathan Chancellor
  2022-07-06  0:09   ` Andy Lutomirski
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Xu (Hello71) @ 2022-07-01 21:04 UTC (permalink / raw)
  To: Nathan Chancellor, Peter Zijlstra, x86, llvm
  Cc: Andy Lutomirski, H. Peter Anvin, Nick Desaulniers,
	Masahiro Yamada, linux-kernel, Alex Xu (Hello71)

According to the comment and commit message, there are issues compiling
with IBT and/or compressed debug sections. Therefore, the condition
should be restricted to when those are enabled.

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index be0b95e51df6..e5af1088420e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2847,7 +2847,7 @@ config X86_X32_ABI
 	# compressed debug sections to x86_x32 properly:
 	# https://github.com/ClangBuiltLinux/linux/issues/514
 	# https://github.com/ClangBuiltLinux/linux/issues/1141
-	depends on $(success,$(OBJCOPY) --version | head -n1 | grep -qv llvm)
+	depends on !X86_KERNEL_IBT || !DEBUG_INFO_COMPRESSED || $(success,$(OBJCOPY) --version | head -n1 | grep -qv llvm)
 	help
 	  Include code to run binaries for the x32 native 32-bit ABI
 	  for 64-bit processors.  An x32 process gets access to the
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/Kconfig: Allow X86_X32_ABI with llvm-objcopy in some cases
  2022-07-01 21:04 ` [PATCH] x86/Kconfig: Allow X86_X32_ABI with llvm-objcopy in some cases Alex Xu (Hello71)
@ 2022-07-01 21:20   ` Nathan Chancellor
  2022-07-06  0:09   ` Andy Lutomirski
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2022-07-01 21:20 UTC (permalink / raw)
  To: Alex Xu (Hello71)
  Cc: Peter Zijlstra, x86, llvm, Andy Lutomirski, H. Peter Anvin,
	Nick Desaulniers, Masahiro Yamada, linux-kernel

Hi Alex,

On Fri, Jul 01, 2022 at 05:04:37PM -0400, Alex Xu (Hello71) wrote:
> According to the comment and commit message, there are issues compiling
> with IBT and/or compressed debug sections. Therefore, the condition
> should be restricted to when those are enabled.
> 
> Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
> ---
>  arch/x86/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index be0b95e51df6..e5af1088420e 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2847,7 +2847,7 @@ config X86_X32_ABI
>  	# compressed debug sections to x86_x32 properly:
>  	# https://github.com/ClangBuiltLinux/linux/issues/514
>  	# https://github.com/ClangBuiltLinux/linux/issues/1141
> -	depends on $(success,$(OBJCOPY) --version | head -n1 | grep -qv llvm)
> +	depends on !X86_KERNEL_IBT || !DEBUG_INFO_COMPRESSED || $(success,$(OBJCOPY) --version | head -n1 | grep -qv llvm)
>  	help
>  	  Include code to run binaries for the x32 native 32-bit ABI
>  	  for 64-bit processors.  An x32 process gets access to the
> -- 
> 2.36.1
> 

Personally, I would rather not play whack-a-mole with these dependencies
here. To me, https://github.com/ClangBuiltLinux/linux/issues/1141
appears to be a pretty fundamental problem. Right now, IBT is the only
known configuration that results in a .note.gnu.property section but
there might be other configurations in the future that will necessitate
adding other configurations here, which I am not a fan of. See commit
8cdd23c23c3d ("arm64: Restrict ARM64_BTI_KERNEL to clang 12.0.0 and
newer") for a similar situation on the arm64 side. I would much rather
effort be put towards fixing llvm-objcopy or coming up with a solution
that avoids using objcopy for x32 altogether.

That is just my two cents though, I'll leave it up to the x86 folks if
they want to have this allowlist of configurations.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/Kconfig: Allow X86_X32_ABI with llvm-objcopy in some cases
  2022-07-01 21:04 ` [PATCH] x86/Kconfig: Allow X86_X32_ABI with llvm-objcopy in some cases Alex Xu (Hello71)
  2022-07-01 21:20   ` Nathan Chancellor
@ 2022-07-06  0:09   ` Andy Lutomirski
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Lutomirski @ 2022-07-06  0:09 UTC (permalink / raw)
  To: Alex Xu (Hello71), Nathan Chancellor, Peter Zijlstra, x86, llvm
  Cc: H. Peter Anvin, Nick Desaulniers, Masahiro Yamada, linux-kernel

On 7/1/22 14:04, Alex Xu (Hello71) wrote:
> According to the comment and commit message, there are issues compiling
> with IBT and/or compressed debug sections. Therefore, the condition
> should be restricted to when those are enabled.

This whole situation is gross.  We code in the vDSO that needs to 
dereference a genuinely 64-bit pointer.  The x32 toolchain doesn't 
understand this, so we have a massive hack using objcopy.  I see a few 
solutions:

1. Keep the hack alive, with further hacks like this patch.

2. Drop the x32 vDSO.

3. Drop x32.

4. Get gcc and/or clang to add actual support for this.

I admit I'm partial to solution #3.  I wonder how practical #4 is.

--Andy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-06  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220701210437.579322-1-alex_y_xu.ref@yahoo.ca>
2022-07-01 21:04 ` [PATCH] x86/Kconfig: Allow X86_X32_ABI with llvm-objcopy in some cases Alex Xu (Hello71)
2022-07-01 21:20   ` Nathan Chancellor
2022-07-06  0:09   ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).