lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231226163802.GA952423@dev-arch.thelio-3990X>
Date: Tue, 26 Dec 2023 09:38:02 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Bjorn Andersson <quic_bjorande@...cinc.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Subject: Re: [PATCH] scripts/decode_stacktrace.sh: Support LLVM addr2line

On Mon, Dec 25, 2023 at 10:52:57AM -0800, Bjorn Andersson wrote:
> The kernel build system adhere to the LLVM environment variable, to
> select building the kernel using clang/llvm. In combination with the
> ARCH environment variable the kernel can be cross-compiled without the
> user specifying the CROSS_COMPILE variable.
> 
> The LLVM environment variable is used to specify the suffix of the llvm
> executables (such as LLVM=-12 for llvm-addr2line-12), or to omit the
> suffix when set to "1" (e.g. llvm-addr2line).
> 
> decode_stacktrace.sh allows invoking a specific addr2line executable by
> prefixing the command with CROSS_COMPILE. At best allows the user to
> trick decode_stacktrace.sh into invoking llvm-addr2line, and it does not
> support specifying an alternative version based on the suffix.
> 
> Teach decode_stacktrace.sh about the two cases of the LLVM environment
> variable, and use this to determine which addr2line to use. The current
> behavior is maintained when the LLVM variable is not set.
> 
> Signed-off-by: Bjorn Andersson <quic_bjorande@...cinc.com>

Hmmm, this is the second patch to decode_stacktrace.sh in the same
number of weeks...

https://lore.kernel.org/20231215-llvm-decode-stacktrace-v1-1-201cb86f4879@quicinc.com/

Nick pointed out on that one that Carlos's patch from some time ago was
even better at using all LLVM tools and requested testing/review on that
one.

https://lore.kernel.org/20230929034836.403735-1-cmllamas@google.com/

Furthermore, this patch does not handle the LLVM=<prefix>/bin/ syntax
that we support, which I personally use all the time.

Cheers,
Nathan

> ---
>  scripts/decode_stacktrace.sh | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
> index 564c5632e1a2..adf1d64477a1 100755
> --- a/scripts/decode_stacktrace.sh
> +++ b/scripts/decode_stacktrace.sh
> @@ -16,6 +16,13 @@ elif type c++filt >/dev/null 2>&1 ; then
>  	cppfilt_opts=-i
>  fi
>  
> +# Determine which addr2line to use
> +case "$LLVM" in
> +	""	) addr2line="${CROSS_COMPILE}addr2line";;
> +	"1"	) addr2line="llvm-addr2line";;
> +	*	) addr2line="llvm-addr2line${LLVM}";;
> +esac
> +
>  if [[ $1 == "-r" ]] ; then
>  	vmlinux=""
>  	basepath="auto"
> @@ -169,7 +176,7 @@ parse_symbol() {
>  	if [[ $aarray_support == true && "${cache[$module,$address]+isset}" == "isset" ]]; then
>  		local code=${cache[$module,$address]}
>  	else
> -		local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null)
> +		local code=$(${addr2line} -i -e "$objfile" "$address" 2>/dev/null)
>  		if [[ $aarray_support == true ]]; then
>  			cache[$module,$address]=$code
>  		fi
> 
> ---
> base-commit: 39676dfe52331dba909c617f213fdb21015c8d10
> change-id: 20231225-decode-stacktrace-llvm-f260a1614361
> 
> Best regards,
> -- 
> Bjorn Andersson <quic_bjorande@...cinc.com>
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ