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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 6 Sep 2019 09:11:54 +0000
From:   Andrii Nakryiko <andriin@...com>
To:     Yonghong Song <yhs@...com>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        "daniel@...earbox.net" <daniel@...earbox.net>
CC:     "andrii.nakryiko@...il.com" <andrii.nakryiko@...il.com>,
        Kernel Team <Kernel-team@...com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        "Masahiro Yamada" <yamada.masahiro@...ionext.com>
Subject: Re: [PATCH bpf-next] kbuild: replace BASH-specific ${@:2} with shift
 and ${@}

On 9/6/19 12:59 AM, Yonghong Song wrote:
> 
> 
> On 9/5/19 10:59 AM, Andrii Nakryiko wrote:
>> ${@:2} is BASH-specific extension, which makes link-vmlinux.sh rely on
>> BASH. Use shift and ${@} instead to fix this issue.
>>
>> Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
>> Fixes: 341dfcf8d78e ("btf: expose BTF info through sysfs")
>> Cc: Stephen Rothwell <sfr@...b.auug.org.au>
>> Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>
>> Signed-off-by: Andrii Nakryiko <andriin@...com>
> 
> Tested with bash/sh/csh, all works.

Thanks for testing, Yonghong! In my system sh is an alias to bash, so it 
still behaved like bash and didn't fail even with existing code. I 
didn't have an opportunity to install csh at that time and try it, so 
thanks a lot for confirming. I basically relied on documentation to 
verify shift and $@ is not BASH'ism.

> Acked-by: Yonghong Song <yhs@...com>
> 
>> ---
>>    scripts/link-vmlinux.sh | 16 +++++++++++-----
>>    1 file changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
>> index 0d8f41db8cd6..8c59970a09dc 100755
>> --- a/scripts/link-vmlinux.sh
>> +++ b/scripts/link-vmlinux.sh
>> @@ -57,12 +57,16 @@ modpost_link()
>>    
>>    # Link of vmlinux
>>    # ${1} - output file
>> -# ${@:2} - optional extra .o files
>> +# ${2}, ${3}, ... - optional extra .o files
>>    vmlinux_link()
>>    {
>>    	local lds="${objtree}/${KBUILD_LDS}"
>> +	local output=${1}
>>    	local objects
>>    
>> +	# skip output file argument
>> +	shift
>> +
>>    	if [ "${SRCARCH}" != "um" ]; then
>>    		objects="--whole-archive			\
>>    			${KBUILD_VMLINUX_OBJS}			\
>> @@ -70,9 +74,10 @@ vmlinux_link()
>>    			--start-group				\
>>    			${KBUILD_VMLINUX_LIBS}			\
>>    			--end-group				\
>> -			${@:2}"
>> +			${@}"
>>    
>> -		${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${1}	\
>> +		${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux}	\
>> +			-o ${output}				\
>>    			-T ${lds} ${objects}
>>    	else
>>    		objects="-Wl,--whole-archive			\
>> @@ -81,9 +86,10 @@ vmlinux_link()
>>    			-Wl,--start-group			\
>>    			${KBUILD_VMLINUX_LIBS}			\
>>    			-Wl,--end-group				\
>> -			${@:2}"
>> +			${@}"
>>    
>> -		${CC} ${CFLAGS_vmlinux} -o ${1}			\
>> +		${CC} ${CFLAGS_vmlinux}				\
>> +			-o ${output}				\
>>    			-Wl,-T,${lds}				\
>>    			${objects}				\
>>    			-lutil -lrt -lpthread
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ