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-next>] [day] [month] [year] [list]
Message-ID: <56FD63F4.2010500@fb.com>
Date:	Thu, 31 Mar 2016 10:52:52 -0700
From:	Alexei Starovoitov <ast@...com>
To:	"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
	<linux-kernel@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>
CC:	"David S . Miller" <davem@...emloft.net>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Michael Ellerman <mpe@...erman.id.au>,
	Daniel Borkmann <daniel@...earbox.net>,
	<netdev@...r.kernel.org>
Subject: Re: [PATCH 4/4] samples/bpf: Enable powerpc support

On 3/31/16 4:25 AM, Naveen N. Rao wrote:
> Add the necessary definitions for building bpf samples on ppc.
>
> Since ppc doesn't store function return address on the stack, modify how
> PT_REGS_RET() and PT_REGS_FP() work.
>
> Also, introduce PT_REGS_IP() to access the instruction pointer. I have
> fixed this to work with x86_64 and arm64, but not s390.
>
> Cc: Alexei Starovoitov <ast@...com>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@...ibm.com>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
> ---
...
> +
> +#ifdef __powerpc__
> +#define BPF_KPROBE_READ_RET_IP(ip, ctx)		{ (ip) = (ctx)->link; }
> +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx)	BPF_KPROBE_READ_RET_IP(ip, ctx)
> +#else
> +#define BPF_KPROBE_READ_RET_IP(ip, ctx)						\
> +		bpf_probe_read(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx))
> +#define BPF_KRETPROBE_READ_RET_IP(ip, ctx)					\
> +		bpf_probe_read(&(ip), sizeof(ip),				\
> +				(void *)(PT_REGS_FP(ctx) + sizeof(ip)))

makes sense, but please use ({ }) gcc extension instead of {} and
open call to make sure that macro body is scoped.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ