From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Fastabend Subject: Re: [PATCH v2 bpf-next 2/2] bpf: sockmap: initialize sg table entries properly Date: Thu, 29 Mar 2018 20:37:18 -0700 Message-ID: <5d47187a-d17d-3ed9-55bb-7d961b48f9ee@gmail.com> References: <20180330002100.5724-1-bhole_prashant_q7@lab.ntt.co.jp> <20180330002100.5724-3-bhole_prashant_q7@lab.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Prashant Bhole , Daniel Borkmann , Alexei Starovoitov , "David S . Miller" Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:44603 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752487AbeC3Dha (ORCPT ); Thu, 29 Mar 2018 23:37:30 -0400 Received: by mail-pf0-f195.google.com with SMTP id m68so4624007pfm.11 for ; Thu, 29 Mar 2018 20:37:30 -0700 (PDT) In-Reply-To: <20180330002100.5724-3-bhole_prashant_q7@lab.ntt.co.jp> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 03/29/2018 05:21 PM, Prashant Bhole wrote: > When CONFIG_DEBUG_SG is set, sg->sg_magic is initialized in > sg_init_table() and it is verified in sg api while navigating. We hit > BUG_ON when magic check is failed. > > In functions sg_tcp_sendpage and sg_tcp_sendmsg, the struct containing > the scatterlist is already zeroed out. So to avoid extra memset, we > use sg_init_marker() to initialize sg_magic. > > Fixed following things: > - In bpf_tcp_sendpage: initialize sg using sg_init_marker > - In bpf_tcp_sendmsg: Replace sg_init_table with sg_init_marker > - In bpf_tcp_push: Replace memset with sg_init_table where consumed > sg entry needs to be re-initialized. > > Signed-off-by: Prashant Bhole > --- > kernel/bpf/sockmap.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > Acked-by: John Fastabend