Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp787046imj; Fri, 15 Feb 2019 06:50:14 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia0LCUYikrtvLkqDfFobMJrDyzsCVJVwz6fpzaIci07XWZx8gxNVj1Ow7FUAtAXUmRmyxK9 X-Received: by 2002:a62:bd13:: with SMTP id a19mr10153292pff.222.1550242214473; Fri, 15 Feb 2019 06:50:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550242214; cv=none; d=google.com; s=arc-20160816; b=lF2e+4mmq3HBtBanwbMiUYI4IR1XJJUKw4uR3CgOKlDO9PtJXDvihNmkXR8pLGZ075 0Aao+P+1aW7cNxoUKaizP+AQtuAeW42EkNamp2XQiB0X9g0KmiiVapMnHrssnFxzkZNg FWJfNRh01DuMNexwN76LuZjW1tM5c/aUh61cvCdF96hQ+7mpLR9CBvJKH0lh9BlVrpWP dsMDIlJZ0bTcFGTcetUuroIan0vRYk5p84D4PyMzxmaR+Lrv8k3HX9e6uo13iOZRj2Wp cB8jrpzYMmCakXaZxgidP0kaJzWiNAL+ooPsS5sQLh2NLIeUBvZiBzETuO9FUajegGZn QoYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fE42wc5TlDNro0NMic5e0igNhiAZNk2cIaolJCsn0Zo=; b=UIABl1vOt43NNUAPCaIA1yeSyLFca3qFlGPo7QrSexJuZ1/FlZJVftBhKW/OjeTWmX ij9y2xR6LCen0Ep9CXry3xd4JmEIuXIrC2JywPu9Svn00hUeG58/+zdsmtArrrEF0I/m 7Ih2/ynqoo1xJAywskp4zSKnyE4y/UbVjOLMXeEeNbWdP7oRXKujDjeQ6zfEdCtbPrZm 9jGtEXp1Knz26Ka8JR6dNs/GymkOte8IHdL05WqsKqFbrfgd8uwpp7xEupwjzYS3277h deQgrEibXUSmhCWpCWoozu+rgb61UEym4oFsWwoTfK5e9a7KEg9u8RsLyFvRMP/7aceN eFRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si5058964pgp.429.2019.02.15.06.49.58; Fri, 15 Feb 2019 06:50:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730108AbfBODbV (ORCPT + 99 others); Thu, 14 Feb 2019 22:31:21 -0500 Received: from nautica.notk.org ([91.121.71.147]:48203 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbfBODbU (ORCPT ); Thu, 14 Feb 2019 22:31:20 -0500 Received: by nautica.notk.org (Postfix, from userid 1001) id 9AB7CC009; Fri, 15 Feb 2019 04:31:17 +0100 (CET) Date: Fri, 15 Feb 2019 04:31:02 +0100 From: Dominique Martinet To: Tom Herbert Cc: David Miller , doronrk@fb.com, Tom Herbert , Dave Watson , Linux Kernel Network Developers , LKML Subject: Re: [PATCH v2] kcm: remove any offset before parsing messages Message-ID: <20190215033102.GA3099@nautica> References: <1536657703-27577-1-git-send-email-asmadeus@codewreck.org> <20180912053642.GA2912@nautica> <20180917.184502.447385458615284933.davem@davemloft.net> <20180918015723.GA26300@nautica> <20181031025657.GA17861@nautica> <20190215010029.GA10899@nautica> <20190215015705.GA17974@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tom Herbert wrote on Thu, Feb 14, 2019: > > This second patch[2] (the current thread) now does an extra clone if > > there is an offset, but the problem really isn't in the clone but the > > pull itself that can fail and return NULL when there is memory pressure. > > For some reason I hadn't been able to reproduce that behaviour with > > strparser doing the pull, but I assume it would also be possible to hit > > in extreme situations, I'm not sure... > > This option looks the best to me, at least as a way to fix the issue > without requiring a change to the API. If the pull fails, doesn't that > just mean that the parser fails? Is there some behavior with this > patch that is not being handled gracefully? Yes, the parser fails with -ENOMEM ; that is not handled gracefully at all: from a user point of view, the connection just hangs (recvmsg never returns), without so much as a message in dmesg either. It took me a while to figure out what failed exactly as I did indeed expect strparser/kcm to handle that better, but ultimately as things stand if the parser fails it calls strp_parser_err() with the error which ends up in strp_abort_strp that should call sk->sk_error_report(sk) but in kcm case sk is the csk and I guess failing csk does not make a pending recv on the kcm sock to fail... I'm not sure whether propagating the error to the upper socket is the right thing to do, kcm is meant to be able to work with multiple underlying sockets so I feel we must be cautious about that, but strparser might be able to retry somehow. This is what I said below: > > [,,,] > > - the current patch, that I could only get to fail with KASAN, but does > > complexify kcm a bit; this also does not fix bpf sockmap at all. > > Would still require to fix the hang, so make strparser retry a few times > > if strp->cb.parse_msg failed maybe? Or at least get the error back to > > userspace somehow. Thanks, -- Dominique