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
| ||
|
Date: Wed, 1 Nov 2017 10:23:36 -0700 From: Alexei Starovoitov <ast@...com> To: Josef Bacik <josef@...icpanda.com>, <rostedt@...dmis.org>, <mingo@...hat.com>, <davem@...emloft.net>, <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>, <ast@...nel.org>, <kernel-team@...com> CC: Josef Bacik <jbacik@...com> Subject: Re: [PATCH 2/2] samples/bpf: add a test for bpf_override_return On 11/1/17 10:00 AM, Josef Bacik wrote: > From: Josef Bacik <jbacik@...com> > > This adds a basic test for bpf_override_return to verify it works. We > override the main function for mounting a btrfs fs so it'll return > -ENOMEM and then make sure that trying to mount a btrfs fs will fail. > > Signed-off-by: Josef Bacik <jbacik@...com> Acked-by: Alexei Starovoitov <ast@...nel.org> > +++ b/samples/bpf/test_override_return.sh > @@ -0,0 +1,15 @@ > +#!/bin/bash > + > +rm -f testfile.img > +dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 > +DEVICE=$(losetup --show -f testfile.img) > +mkfs.btrfs -f $DEVICE > +mkdir tmpmnt > +./tracex7 $DEVICE > +if [ $? -eq 0 ] > +then > + echo "SUCCESS!" > +else > + echo "FAILED!" > +fi > +losetup -d $DEVICE > diff --git a/samples/bpf/tracex7_kern.c b/samples/bpf/tracex7_kern.c > new file mode 100644 > index 000000000000..1ab308a43e0f > --- /dev/null > +++ b/samples/bpf/tracex7_kern.c > @@ -0,0 +1,16 @@ > +#include <uapi/linux/ptrace.h> > +#include <uapi/linux/bpf.h> > +#include <linux/version.h> > +#include "bpf_helpers.h" > + > +SEC("kprobe/open_ctree") > +int bpf_prog1(struct pt_regs *ctx) > +{ > + unsigned long rc = -12; > + > + bpf_override_return(ctx, rc); > + return 0; > +} great stuff. I wonder in how many kernel test frameworks it will appear in the near future. We can even stress test bpf with bpf.
Powered by blists - more mailing lists