[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e09c45fac7bb688e5e248449594625eda97a2791.camel@perches.com>
Date: Wed, 13 May 2020 16:23:42 -0700
From: Joe Perches <joe@...ches.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Alan Maguire <alan.maguire@...cle.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
bpf <bpf@...r.kernel.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>,
Yonghong Song <yhs@...com>, Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
LKML <linux-kernel@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 bpf-next 0/7] bpf, printk: add BTF-based type printing
On Wed, 2020-05-13 at 15:50 -0700, Alexei Starovoitov wrote:
> On Wed, May 13, 2020 at 3:48 PM Joe Perches <joe@...ches.com> wrote:
> > On Wed, 2020-05-13 at 15:24 -0700, Alexei Starovoitov wrote:
> > > On Tue, May 12, 2020 at 06:56:38AM +0100, Alan Maguire wrote:
> > > > The printk family of functions support printing specific pointer types
> > > > using %p format specifiers (MAC addresses, IP addresses, etc). For
> > > > full details see Documentation/core-api/printk-formats.rst.
> > > >
> > > > This patchset proposes introducing a "print typed pointer" format
> > > > specifier "%pT"; the argument associated with the specifier is of
> > > > form "struct btf_ptr *" which consists of a .ptr value and a .type
> > > > value specifying a stringified type (e.g. "struct sk_buff") or
> > > > an .id value specifying a BPF Type Format (BTF) id identifying
> > > > the appropriate type it points to.
> > > >
> > > > pr_info("%pT", BTF_PTR_TYPE(skb, "struct sk_buff"));
> > > >
> > > > ...gives us:
> > > >
> > > > (struct sk_buff){
> > > > .transport_header = (__u16)65535,
> > > > .mac_header = (__u16)65535,
> > > > .end = (sk_buff_data_t)192,
> > > > .head = (unsigned char *)000000007524fd8b,
> > > > .data = (unsigned char *)000000007524fd8b,
> > >
> > > could you add "0x" prefix here to make it even more C like
> > > and unambiguous ?
> >
> > linux pointers are not emitted with an 0x prefix
>
> So? This is not at all comparable to %p
Then why is x used to obfuscate?
Powered by blists - more mailing lists