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: <885c2504-8f32-4936-ac6e-24fbfd07e43d@huawei.com>
Date: Sat, 6 Jul 2024 10:28:28 +0800
From: Pu Lehui <pulehui@...wei.com>
To: Puranjay Mohan <puranjay@...nel.org>, Pu Lehui <pulehui@...weicloud.com>,
	<bpf@...r.kernel.org>, <linux-riscv@...ts.infradead.org>,
	<netdev@...r.kernel.org>
CC: Björn Töpel <bjorn@...nel.org>, Alexei Starovoitov
	<ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko
	<andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, Eduard
 Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, Yonghong Song
	<yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, KP
 Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>, Hao Luo
	<haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, Palmer Dabbelt
	<palmer@...belt.com>
Subject: Re: [PATCH bpf-next v6 1/3] riscv, bpf: Add 12-argument support for
 RV64 bpf trampoline


On 2024/7/5 20:51, Puranjay Mohan wrote:
> Pu Lehui <pulehui@...weicloud.com> writes:
> 
>> From: Pu Lehui <pulehui@...wei.com>
>>
>> This patch adds 12 function arguments support for riscv64 bpf
>> trampoline. The current bpf trampoline supports <= sizeof(u64) bytes
>> scalar arguments [0] and <= 16 bytes struct arguments [1]. Therefore, we
>> focus on the situation where scalars are at most XLEN bits and
>> aggregates whose total size does not exceed 2×XLEN bits in the riscv
>> calling convention [2].
[SNIP]
>> @@ -854,7 +875,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
>>   		retval_off = stack_size;
>>   	}
>>   
>> -	stack_size += nregs * 8;
>> +	stack_size += nr_arg_slots * 8;
>>   	args_off = stack_size;
>>   
>>   	stack_size += 8;
>> @@ -871,8 +892,14 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
>>   	stack_size += 8;
>>   	sreg_off = stack_size;
>>   
>> +	if (nr_arg_slots - RV_MAX_REG_ARGS > 0)
>> +		stack_size += (nr_arg_slots - RV_MAX_REG_ARGS) * 8;
> 
> Hi Pu,
> Although this is merged now, while working on this for arm64 I realised
> that the above doesn't check for BPF_TRAMP_F_CALL_ORIG and can waste
> some stack space, we should change this to:
> 
> if ((flags & BPF_TRAMP_F_CALL_ORIG) && (nr_arg_slots - RV_MAX_REG_ARGS > 0))
>          stack_size += (nr_arg_slots - RV_MAX_REG_ARGS) * 8;
> 
> It will save some stack space when BPF_TRAMP_F_CALL_ORIG is not set?

Nice catch. It will be better. Feel free to patch it. Thanks!

> 
> I can send a patch if you think this is worth fixing.
> 
> 
> Thanks,
> Puranjay

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ