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] [day] [month] [year] [list]
Date:   Sat, 7 Jul 2018 11:49:46 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Okash Khawaja <osk@...com>
Cc:     Martin KaFai Lau <kafai@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Yonghong Song <yhs@...com>,
        Quentin Monnet <quentin.monnet@...ronome.com>,
        "David S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>,
        <kernel-team@...com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 2/3] bpf: btf: add btf print functionality

On Sat, 7 Jul 2018 14:30:58 +0100, Okash Khawaja wrote:
> On Tue, Jul 03, 2018 at 04:33:50PM -0700, Martin KaFai Lau wrote:
> > On Tue, Jul 03, 2018 at 03:38:43PM -0700, Jakub Kicinski wrote:  
> > > On Tue, 3 Jul 2018 15:23:31 -0700, Jakub Kicinski wrote:  
> > > > > > > +			else
> > > > > > > +				jsonw_printf(jw, "%hhd", *((char *)data));      
> > > > > > 
> > > > > > ... I think you need to always print a string, and express it as
> > > > > > \u00%02hhx for non-printable.      
> > > > > Okay that makes sense    
> > > > 
> > > > Yeah, IDK, char can be used as a byte as well as a string.  In eBPF
> > > > it may actually be more likely to just be used as a raw byte buffer...  
> > > 
> > > Actually, what is the definition/purpose of BTF_INT_CHAR?  There seems
> > > to be no BTF_INT_SHORT and BTF_INT_SIGNED can simply be of size 8...
> > > Is normal int only used for bitfields of size 8 and BTF_INT_CHAR for
> > > char variables?
> > > 
> > > The kernel seems to be rejecting combinations of those flags, is
> > > unsigned char going to not be marked as char then?  
> > BTF_INT_ENOCODING (CHAR/SIGNED/BOOL) is for formatting (e.g. pretty
> > print).  It is mainly how CTF is using it also.  Hence, BTF_INT_ENCODINGs
> > is not a 1:1 mapping to C integer types.
> > The size of an interger is described by BTF_INT_BITS instead.  
> >   
> > >   
> > > > Either way I think it may be nice to keep it consistent, at least for
> > > > the JSON output could we do either always ints or always characters?  
> > >  
> 
> for !isprint() case, will "\x%02hhx" make more sense?

According to (quick look over) the JSON standard \x%02hhx is not a
valid escape sequence, everything has to be Unicode, so \u00%02hhx.
JSON validators online agree seem to reject \x as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ