Re: [PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-06 Thread Alexei Starovoitov
On Tue, Aug 6, 2019 at 2:36 AM Quentin Monnet wrote: > > >>> { > >>> - size_t line_n = 0, optlen = strlen(option); > >>> - char *res, *strval, *line = NULL; > >>> - ssize_t n; > >>> + char *sep; > >>> + ssize_t linelen; > >> > >> Please order the declarations in reverse-Christmas tree s

Re: [PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-06 Thread Quentin Monnet
Hi Peter, 2019-08-06 00:54 UTC+0100 ~ Peter Wu > Hi all, > > Thank you for your quick feedback, I will address them in the next > revision. > > On Mon, Aug 05, 2019 at 11:41:09AM +0100, Quentin Monnet wrote: > >> As far as I understood (from examining Cilium [0]), /proc/config _is_ >> used by

Re: [PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-05 Thread Peter Wu
Hi all, Thank you for your quick feedback, I will address them in the next revision. On Mon, Aug 05, 2019 at 11:41:09AM +0100, Quentin Monnet wrote: > As far as I understood (from examining Cilium [0]), /proc/config _is_ > used by some distributions, such as CoreOS. This is why we look at that >

Re: [PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-05 Thread Jakub Kicinski
On Mon, 5 Aug 2019 08:29:36 -0700, Stanislav Fomichev wrote: > On 08/05, Peter Wu wrote: > > /proc/config has never existed as far as I can see, but /proc/config.gz > > is present on Arch Linux. Execute an external gunzip program to avoid > > linking to zlib and rework the option scanning code sinc

Re: [PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-05 Thread Stanislav Fomichev
On 08/05, Peter Wu wrote: > /proc/config has never existed as far as I can see, but /proc/config.gz > is present on Arch Linux. Execute an external gunzip program to avoid > linking to zlib and rework the option scanning code since a pipe is not > seekable. This also fixes a file handle leak on som

Re: [PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-05 Thread Quentin Monnet
Hi Peter, Thanks for looking into this (and for the fixes)! Some comments below. 2019-08-05 01:15 UTC+0100 ~ Peter Wu > /proc/config has never existed as far as I can see, but /proc/config.gz As far as I understood (from examining Cilium [0]), /proc/config _is_ used by some distributions, such

[PATCH] tools: bpftool: fix reading from /proc/config.gz

2019-08-04 Thread Peter Wu
/proc/config has never existed as far as I can see, but /proc/config.gz is present on Arch Linux. Execute an external gunzip program to avoid linking to zlib and rework the option scanning code since a pipe is not seekable. This also fixes a file handle leak on some error paths. Fixes: 4567b983f78