Message ID | 20220531185933.1086667-2-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: af_packet: be careful when expanding mac header size | expand |
On Tue, May 31, 2022 at 2:59 PM Eric Dumazet <eric.dumazet@gmail.com> wrote: > > From: Eric Dumazet <edumazet@google.com> > > While analyzing yet another syzbot report, I found the following > patch very useful. It allows to better understand what went wrong. > > This debug info is only enabled if CONFIG_DEBUG_NET=y, > which is the case for syzbot builds. > > Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Willem de Bruijn <willemb@google.com> The skb_dump output (including packet headers) on these bugs will make root causing these failures a lot easier in the future. Thanks!
Hi Eric,
I love your patch! Yet something to improve:
[auto build test ERROR on net/master]
url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-af_packet-be-careful-when-expanding-mac-header-size/20220601-030146
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 09e545f7381459c015b6fa0cd0ac6f010ef8cc25
config: arc-randconfig-r021-20220531 (https://download.01.org/0day-ci/archive/20220601/202206011509.Rpp82wrl-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a907c048e7699133feedaa06948c15c719a59f94
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Eric-Dumazet/net-af_packet-be-careful-when-expanding-mac-header-size/20220601-030146
git checkout a907c048e7699133feedaa06948c15c719a59f94
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
arc-elf-ld: kernel/bpf/cgroup.o: in function `__skb_pull':
include/linux/skbuff.h:2703: undefined reference to `skb_dump'
>> arc-elf-ld: include/linux/skbuff.h:2703: undefined reference to `skb_dump'
On Wed, Jun 1, 2022 at 12:28 AM kernel test robot <lkp@intel.com> wrote: > > Hi Eric, > > I love your patch! Yet something to improve: > > [auto build test ERROR on net/master] > > url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-af_packet-be-careful-when-expanding-mac-header-size/20220601-030146 > base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 09e545f7381459c015b6fa0cd0ac6f010ef8cc25 > config: arc-randconfig-r021-20220531 (https://download.01.org/0day-ci/archive/20220601/202206011509.Rpp82wrl-lkp@intel.com/config) > compiler: arc-elf-gcc (GCC) 11.3.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/intel-lab-lkp/linux/commit/a907c048e7699133feedaa06948c15c719a59f94 > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review Eric-Dumazet/net-af_packet-be-careful-when-expanding-mac-header-size/20220601-030146 > git checkout a907c048e7699133feedaa06948c15c719a59f94 > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash > > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot <lkp@intel.com> > > All errors (new ones prefixed by >>): > > arc-elf-ld: kernel/bpf/cgroup.o: in function `__skb_pull': > include/linux/skbuff.h:2703: undefined reference to `skb_dump' > >> arc-elf-ld: include/linux/skbuff.h:2703: undefined reference to `skb_dump' > So... CONFIG_NET=n and yet __cgroup_bpf_run_filter_skb() is using skbs ? Not sure if this makes any sense. > > -- > 0-DAY CI Kernel Test Service > https://01.org/lkp
Hi Eric, I love your patch! Yet something to improve: [auto build test ERROR on net/master] url: https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-af_packet-be-careful-when-expanding-mac-header-size/20220601-030146 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 09e545f7381459c015b6fa0cd0ac6f010ef8cc25 config: hexagon-randconfig-r002-20220531 (https://download.01.org/0day-ci/archive/20220602/202206020557.QyvlGs0H-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c825abd6b0198fb088d9752f556a70705bc99dfd) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/a907c048e7699133feedaa06948c15c719a59f94 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Eric-Dumazet/net-af_packet-be-careful-when-expanding-mac-header-size/20220601-030146 git checkout a907c048e7699133feedaa06948c15c719a59f94 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> ld.lld: error: undefined symbol: skb_dump >>> referenced by cgroup.c >>> bpf/cgroup.o:(__cgroup_bpf_run_filter_skb) in archive kernel/built-in.a >>> referenced by cgroup.c >>> bpf/cgroup.o:(__cgroup_bpf_run_filter_skb) in archive kernel/built-in.a
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index da96f0d3e753fb7996631bc9350c0c8e0ec5966e..d3d10556f0faea8c8c1deed5715716d4916011d1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2696,7 +2696,14 @@ void *skb_pull(struct sk_buff *skb, unsigned int len); static inline void *__skb_pull(struct sk_buff *skb, unsigned int len) { skb->len -= len; - BUG_ON(skb->len < skb->data_len); + if (unlikely(skb->len < skb->data_len)) { +#if defined(CONFIG_DEBUG_NET) + skb->len += len; + pr_err("__skb_pull(len=%u)\n", len); + skb_dump(KERN_ERR, skb, false); +#endif + BUG(); + } return skb->data += len; }