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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161020165807.GB97796@ast-mbp.thefacebook.com>
Date:   Thu, 20 Oct 2016 09:58:09 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     William Tu <u9012063@...il.com>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [RFC PATCH net-next] bpf: fix potential percpu map overcopy to
 user.

On Thu, Oct 20, 2016 at 06:04:38PM +0200, Daniel Borkmann wrote:
> 
> diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
> index ee384f0..d4832e8 100644
> --- a/tools/testing/selftests/bpf/test_maps.c
> +++ b/tools/testing/selftests/bpf/test_maps.c
> @@ -25,6 +25,33 @@
> 
>  static int map_flags;
> 
> +static unsigned int num_possible_cpus(void)
> +{
> +	static const char *fcpu = "/sys/devices/system/cpu/possible";
> +	unsigned int val, possible_cpus = 0;
> +	char buff[128];
> +	FILE *fp;
> +
> +	fp = fopen(fcpu, "r");
> +	if (!fp) {
> +		printf("Failed to open %s: '%s'!\n", fcpu, strerror(errno));
> +		exit(1);
> +	}
> +
> +	while (fgets(buff, sizeof(buff), fp)) {
> +		if (sscanf(buff, "%*u-%u", &val) == 1)
> +			possible_cpus = val;
> +	}

looks great to me.
Could you move it into bpf_sys.h or somehow make it common in libbpf
and reuse it in samples/bpf/ ?
Since quite a few samples need this fix as well.
Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ