From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [bpf PATCH v2 0/3] sockmap error path fixes Date: Wed, 2 May 2018 15:34:03 -0700 Message-ID: <20180502223401.2nl7oivuv4qbfznv@ast-mbp> References: <20180502204748.12776.80509.stgit@john-Precision-Tower-5810> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: borkmann@iogearbox.net, ast@kernel.org, netdev@vger.kernel.org To: John Fastabend Return-path: Received: from mail-pg0-f65.google.com ([74.125.83.65]:45522 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751261AbeEBWeH (ORCPT ); Wed, 2 May 2018 18:34:07 -0400 Received: by mail-pg0-f65.google.com with SMTP id i29-v6so11640646pgn.12 for ; Wed, 02 May 2018 15:34:07 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180502204748.12776.80509.stgit@john-Precision-Tower-5810> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, May 02, 2018 at 01:50:14PM -0700, John Fastabend wrote: > When I added the test_sockmap to selftests I mistakenly changed the > test logic a bit. The result of this was on redirect cases we ended up > choosing the wrong sock from the BPF program and ended up sending to a > socket that had no receive handler. The result was the actual receive > handler, running on a different socket, is timing out and closing the > socket. This results in errors (-EPIPE to be specific) on the sending > side. Typically happening if the sender does not complete the send > before the receive side times out. So depending on timing and the size > of the send we may get errors. This exposed some bugs in the sockmap > error path handling. > > This series fixes the errors. The primary issue is we did not do proper > memory accounting in these cases which resulted in missing a > sk_mem_uncharge(). This happened in the redirect path and in one case > on the normal send path. See the three patches for the details. > > The other take-away from this is we need to fix the test_sockmap and > also add more negative test cases. That will happen in bpf-next. > > Finally, I tested this using the existing test_sockmap program, the > older sockmap sample test script, and a few real use cases with > Cilium. All of these seem to be in working correctly. > > v2: fix compiler warning, drop iterator variable 'i' that is no longer > used in patch 3. Applied, Thanks.