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:	Mon, 1 Dec 2014 10:13:03 +0000
From:	Markos Chandras <Markos.Chandras@...tec.com>
To:	Denis Kirjanov <kda@...ux-powerpc.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH] mips: bpf: Fix broken BPF_MOD

On 12/01/2014 09:57 AM, Denis Kirjanov wrote:
> Remove optimize_div() from BPF_MOD | BPF_K case
> since we don't know the dividend and fix the
> emit_mod() by reading the mod operation result from HI register
> 
> Signed-off-by: Denis Kirjanov <kda@...ux-powerpc.org>
> ---
>  arch/mips/net/bpf_jit.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
> index 9b55143..9fd6834 100644
> --- a/arch/mips/net/bpf_jit.c
> +++ b/arch/mips/net/bpf_jit.c
> @@ -426,7 +426,7 @@ static inline void emit_mod(unsigned int dst, unsigned int src,
>  		u32 *p = &ctx->target[ctx->idx];
>  		uasm_i_divu(&p, dst, src);
>  		p = &ctx->target[ctx->idx + 1];
> -		uasm_i_mflo(&p, dst);
> +		uasm_i_mfhi(&p, dst);

That looks correct.

>  	}
>  	ctx->idx += 2; /* 2 insts */
>  }
> @@ -971,7 +971,7 @@ load_ind:
>  			break;
>  		case BPF_ALU | BPF_MOD | BPF_K:
>  			/* A %= k */
> -			if (k == 1 || optimize_div(&k)) {
> +			if (k == 1) {
>  				ctx->flags |= SEEN_A;
>  				emit_jit_reg_move(r_A, r_zero, ctx);
>  			} else {
> 

That looks correct too. Thanks for fixing these.

Can you also CC stable for inclusion in >=3.16?

Reviewed-by: Markos Chandras <markos.chandras@...tec.com>

-- 
markos
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ