Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3693587ybv; Mon, 10 Feb 2020 04:50:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwE3Tac/h31rutjfV7t2zwAIclVV4rE4Afhgxb4C47y4juAgdMBF5F383KkAZ8BOasZkcRT X-Received: by 2002:a05:6830:1e47:: with SMTP id e7mr978990otj.78.1581339020837; Mon, 10 Feb 2020 04:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339020; cv=none; d=google.com; s=arc-20160816; b=zV0DzSZgfXV2VyF27eoZpvkImAoVxEnwivC6JSHScm7zWIVlynnd3v3F4Wr0s+POw0 Gh6S7Nn/hvcb7P6SxY9wxF+Pf+VS3ZN+jw6kLH7u13c+obbS3zSxQ/lFL7vIx5MC7eAp FiqO14S9RtQN3tyQavjSihFhISRm7dAeN9wnCrdEpqUg6Pp0IuKU2mOfwuuu/pOf0/IB u/QRJdTGAt5VPZMOzkDLoGy3Wr2ikfak6UoEK5AH2h3XdxTmMPiJLcM1HWY0qvarNrGa OiEL+i64BfwcgQceVf7y2/s86qwcG6dCi2VjhcmY3SVca2ZAVnT8i4GLjUZdv/BSPuxN VRvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LD25dpmgeA9YabeX0JDCa8q3jusTW+1ii5fMwa/A+B8=; b=FNzdU28plv3ynOutwrbBNbEad4ST+hPjtNhjHNTjBQFAU6tUhN2WbVXQ7vP80W5855 DHJG2EQcWw869h7tGA6GOFSIthIO/Zuw3UuwOccM38cj9O8Waxz3sIjGA0ucdOjv0W6z s03mmbvZKi47rWeMFcNr/dFJ2xDcBlK85YjWPimyu0Jxru572K+07i6Sq0OwMuDmsq+9 3nFpWheGMWejGHwyVKOPZ7DxIjnGNUE0x/XVORGt4V4nJ75WNLPjgMxxBO03qFhpzZKi 7KTaUFRFIv6TitRsiCdzMbtDxOGlwozeE7yt8DwrJ5BBCN/E66vSKFRxI8ei0ZJL5Of5 3Xgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=egih3imh; 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 l6si139116oti.249.2020.02.10.04.50.08; Mon, 10 Feb 2020 04:50:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=egih3imh; 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 S1730660AbgBJMoc (ORCPT + 99 others); Mon, 10 Feb 2020 07:44:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:40920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729301AbgBJMki (ORCPT ); Mon, 10 Feb 2020 07:40:38 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DFDA420661; Mon, 10 Feb 2020 12:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338438; bh=UUQFGP3pj9DJoqDSltpk18FQw+I+6J/hACUTurBQtEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=egih3imhOsgzU+xsKR6nop60763Y/8C+P1ekdgShlG9Bj/zhGjC8TAQ8b77Q8le+F KJf42j9bcCwBhy8HgJbJiJLslKZ5BHDk+vUboUc0qzQXZrGr2RuOdlmQ0tbgUrk4Q9 /O1z4VOO+gv5EGnzolw+BMz1m+SzveT1hzVsfJFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenz Bauer , Daniel Borkmann , Jakub Sitnicki , Martin KaFai Lau , John Fastabend Subject: [PATCH 5.5 173/367] selftests: bpf: Ignore FIN packets for reuseport tests Date: Mon, 10 Feb 2020 04:31:26 -0800 Message-Id: <20200210122440.824564923@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenz Bauer commit 8bec4f665e0baecb5f1b683379fc10b3745eb612 upstream. The reuseport tests currently suffer from a race condition: FIN packets count towards DROP_ERR_SKB_DATA, since they don't contain a valid struct cmd. Tests will spuriously fail depending on whether check_results is called before or after the FIN is processed. Exit the BPF program early if FIN is set. Fixes: 91134d849a0e ("bpf: Test BPF_PROG_TYPE_SK_REUSEPORT") Signed-off-by: Lorenz Bauer Signed-off-by: Daniel Borkmann Reviewed-by: Jakub Sitnicki Acked-by: Martin KaFai Lau Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20200124112754.19664-3-lmb@cloudflare.com Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c +++ b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c @@ -113,6 +113,12 @@ int _select_by_skb_data(struct sk_reusep data_check.skb_ports[0] = th->source; data_check.skb_ports[1] = th->dest; + if (th->fin) + /* The connection is being torn down at the end of a + * test. It can't contain a cmd, so return early. + */ + return SK_PASS; + if ((th->doff << 2) + sizeof(*cmd) > data_check.len) GOTO_DONE(DROP_ERR_SKB_DATA); if (bpf_skb_load_bytes(reuse_md, th->doff << 2, &cmd_copy,