[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150827.153409.893765406170260565.davem@davemloft.net>
Date: Thu, 27 Aug 2015 15:34:09 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: ast@...mgrid.com
Cc: mingo@...nel.org, rostedt@...dmis.org, wangnan0@...wei.com,
hekuang@...wei.com, daniel@...earbox.net,
brendan.d.gregg@...il.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] bpf: add support for %s specifier to
bpf_trace_printk()
From: Alexei Starovoitov <ast@...mgrid.com>
Date: Wed, 26 Aug 2015 23:26:59 -0700
> +/* similar to strncpy_from_user() but with extra checks */
> +static void probe_read_string(char *buf, int size, long unsafe_ptr)
> +{
> + char dst[4];
> + int i = 0;
> +
> + size--;
> + for (;;) {
> + if (probe_kernel_read(dst, (void *) unsafe_ptr, 4))
> + break;
I don't think this does the right thing when the string is not a multiple
of 3 and ends at the last byte of a page that ends a valid region of
kernel memory.
Seeing this kind of error makes me skeptical to the overall value of
optimizing this :-/
--
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