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]
Message-ID: <af4cf420-558a-4893-8469-c354d3e337eb@huawei.com>
Date: Wed, 22 May 2024 14:29:55 +0800
From: Pu Lehui <pulehui@...wei.com>
To: Xiao Wang <xiao.w.wang@...el.com>, <paul.walmsley@...ive.com>,
	<palmer@...belt.com>, <aou@...s.berkeley.edu>, <luke.r.nels@...il.com>,
	<xi.wang@...il.com>, <bjorn@...nel.org>
CC: <ast@...nel.org>, <daniel@...earbox.net>, <andrii@...nel.org>,
	<martin.lau@...ux.dev>, <eddyz87@...il.com>, <song@...nel.org>,
	<yonghong.song@...ux.dev>, <john.fastabend@...il.com>, <kpsingh@...nel.org>,
	<sdf@...gle.com>, <haoluo@...gle.com>, <jolsa@...nel.org>,
	<linux-riscv@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	<bpf@...r.kernel.org>, <haicheng.li@...el.com>
Subject: Re: [PATCH] riscv, bpf: Use STACK_ALIGN macro for size rounding up


On 2024/5/22 13:45, Xiao Wang wrote:
> Use the macro STACK_ALIGN that is defined in asm/processor.h for stack size
> rounding up, just like bpf_jit_comp32.c does.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@...el.com>
> ---
>   arch/riscv/net/bpf_jit_comp64.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> index 39149ad002da..bd869d41612f 100644
> --- a/arch/riscv/net/bpf_jit_comp64.c
> +++ b/arch/riscv/net/bpf_jit_comp64.c
> @@ -858,7 +858,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
>   	stack_size += 8;
>   	sreg_off = stack_size;
>   
> -	stack_size = round_up(stack_size, 16);
> +	stack_size = round_up(stack_size, STACK_ALIGN);
>   
>   	if (!is_struct_ops) {
>   		/* For the trampoline called from function entry,
> @@ -1723,7 +1723,7 @@ void bpf_jit_build_prologue(struct rv_jit_context *ctx, bool is_subprog)
>   {
>   	int i, stack_adjust = 0, store_offset, bpf_stack_adjust;
>   
> -	bpf_stack_adjust = round_up(ctx->prog->aux->stack_depth, 16);
> +	bpf_stack_adjust = round_up(ctx->prog->aux->stack_depth, STACK_ALIGN);
>   	if (bpf_stack_adjust)
>   		mark_fp(ctx);
>   
> @@ -1743,7 +1743,7 @@ void bpf_jit_build_prologue(struct rv_jit_context *ctx, bool is_subprog)
>   	if (seen_reg(RV_REG_S6, ctx))
>   		stack_adjust += 8;
>   
> -	stack_adjust = round_up(stack_adjust, 16);
> +	stack_adjust = round_up(stack_adjust, STACK_ALIGN);
>   	stack_adjust += bpf_stack_adjust;
>   
>   	store_offset = stack_adjust - 8;

Reviewed-by: Pu Lehui <pulehui@...wei.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ