Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1214920

Re: [PATCH net-next] bpf: add support for %s specifier to bpf_trace_printk()

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH net-next] bpf: add support for %s specifier to bpf_trace_printk()
Date 2015-08-28 00:40 +0200
Message-ID <q2dZU-1aQ-31@gated-at.bofh.it> (permalink)
References <q1YRb-4FI-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alexei Starovoitov <ast@plumgrid.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 linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next] bpf: add support for %s specifier to bpf_trace_printk() Alexei Starovoitov <ast@plumgrid.com> - 2015-08-27 08:30 +0200
  Re: [PATCH net-next] bpf: add support for %s specifier to  bpf_trace_printk() David Miller <davem@davemloft.net> - 2015-08-28 00:40 +0200
    Re: [PATCH net-next] bpf: add support for %s specifier to  bpf_trace_printk() Alexei Starovoitov <ast@plumgrid.com> - 2015-08-28 01:10 +0200
      Re: [PATCH net-next] bpf: add support for %s specifier to  bpf_trace_printk() David Miller <davem@davemloft.net> - 2015-08-28 01:30 +0200
        Re: [PATCH net-next] bpf: add support for %s specifier to  bpf_trace_printk() Steven Rostedt <rostedt@goodmis.org> - 2015-08-28 01:50 +0200
          Re: [PATCH net-next] bpf: add support for %s specifier to  bpf_trace_printk() Alexei Starovoitov <ast@plumgrid.com> - 2015-08-28 04:00 +0200

csiph-web