Received: by 10.213.65.68 with SMTP id h4csp2202638imn; Sun, 8 Apr 2018 22:24:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx49GppJ2CuL+wMpxGyZQd7kEXs/ii2A451hi14yz9b7WDfHu9nIPEsfnE+F1+NoTQTW3M9O4 X-Received: by 10.98.70.8 with SMTP id t8mr28200955pfa.185.1523251445614; Sun, 08 Apr 2018 22:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523251445; cv=none; d=google.com; s=arc-20160816; b=Bk68bakiT72h/V0QHjFzERMJg1VWYRDaCV4tDaZTvz6kiVimLCXSDtGNwKfnF+pq9t XNiOhGYrkuCmG5I3sE5gGNcbfgRck5aQ83dOnop6iTLjVC7zw0W+VN8nIhHytgEJDFr1 urxuTZH6Mb116PsUYZdIXOoz2dWhQJN8WwJkkzkCCOEZ6HU4Dn2QZZfnhKaN0WevuP2A W3kLhjNuLQAcXcgVpoH8Ca9Dg2YI5huCI4z0eRSefvOgzJ5wNysMbcwsxry8X6+W6a/y qWvRvt5Mnsz5Syypwhr87vZShkjT/CJRant7sNdVIR3mId/L/fOcd8sRw75PbJ+e9aQZ eW9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=lLZIdX5CgDZ08SWfXVHt8psMO1O5AJtaP5ml5D9Y2a0=; b=nygzOn2fiWJz3TicuBPteWk8u3p7FUmWrkFtAi0bMcdeRJ72WQJEqvaZnhN3LtZ1BP EpfOn+YYIq6/2auLbLyLWzmU+pVtiDhMmH0UzdpkHR+xhcXvCv08Zcju3TkjEj5KGKYv cyVRAbGyxSCZ5SAYnqtome5j6qg4URBMILsWgHkNwxN6KwVFPA2or6U2GJTkdzvowKM0 ZBTA0vcGVLAkPFAo3yaMuaKgUNUU2LL3sxVIkKDBbqerwn8ZcwPVGTRzltmBnG/vEuc0 ady40300TshAYgm7zPvOc7Oprw3/RuhDIxF2llXprdsG9sRHuFrPCGs/rQmB43AYl00j antg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=DdNcmRWL; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3-v6si13696270plb.39.2018.04.08.22.23.29; Sun, 08 Apr 2018 22:24:05 -0700 (PDT) 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=@microsoft.com header.s=selector1 header.b=DdNcmRWL; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754935AbeDIAXs (ORCPT + 99 others); Sun, 8 Apr 2018 20:23:48 -0400 Received: from mail-by2nam03on0115.outbound.protection.outlook.com ([104.47.42.115]:29467 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753655AbeDIAXp (ORCPT ); Sun, 8 Apr 2018 20:23:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lLZIdX5CgDZ08SWfXVHt8psMO1O5AJtaP5ml5D9Y2a0=; b=DdNcmRWL/6zgjnqlEJPxum0ZnlC5RQb6ROykISNhKUfawinB6UpxRYor1Mh5IPvpQMp+V5Ij+ru+FiOEPvaOew6FCEICSbyRI3+qPE8oKcnMxZC2qlXEMZ1RtJ/jpxmxRUdcVi8Gc3tFyA7k4SaUn9XVz00nKAvUvlbQs7QfmYc= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1080.namprd21.prod.outlook.com (52.132.130.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:23:42 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:23:42 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Prashant Bhole , Daniel Borkmann , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 065/161] bpf: test_maps: cleanup sockmaps when test ends Thread-Topic: [PATCH AUTOSEL for 4.14 065/161] bpf: test_maps: cleanup sockmaps when test ends Thread-Index: AQHTz5iWM+6T7Mt4h0G4VPJ5zW+3Og== Date: Mon, 9 Apr 2018 00:20:39 +0000 Message-ID: <20180409001936.162706-65-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1080;7:+sNV7MFKVKP+h428u8JOdvbWXDIBy8ROYQSi+LJDu40QQc5gUiRh4rNwPZF46X5aLFsjvNJF6PRHDs5T9N9hTfndYdw5f215NG04nO5b7tWHmLQ6ppD0q614KCA2tr7KPN/ptm5FLncWm1lJuAOyFPFNKZPeXNYXp0SroukNeXIFL0xGIWxWWRiEYlrK8NCG9e3rwDdeBXszRn8CT7ZyfAGM7FXpL8y5ieOQfPziBJwtFIHzAm1qz1nJGQj47q7e;20:9XUpX2t6qOppMt2S3Rm7AaKh7E4ME6CIWHnBWCeIxvp8tJisrAn4N5cIiW97gEKLq8JryqE2aPb4ukWYLxcivHXdkcOawkj5zqYnry/dYl8CT2cKQAnahdw2kcbARSmiSxSQsRZfIkAnip7B7DlI+Ov4MY+M0n1vydIApoi1YCQ= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 3b3286d9-19bd-43e7-1d69-08d59db0268b x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1080; x-ms-traffictypediagnostic: DM5PR2101MB1080: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231221)(944501327)(52105095)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB1080;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1080; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(396003)(39380400002)(366004)(39860400002)(199004)(189003)(2501003)(5250100002)(8936002)(10090500001)(5660300001)(3660700001)(446003)(107886003)(14454004)(36756003)(6436002)(476003)(3280700002)(2616005)(11346002)(4326008)(6666003)(53936002)(6512007)(22452003)(305945005)(10290500003)(316002)(102836004)(2906002)(6116002)(66066001)(6506007)(3846002)(7736002)(486006)(54906003)(110136005)(186003)(72206003)(26005)(1076002)(105586002)(2900100001)(6486002)(97736004)(478600001)(81156014)(81166006)(86612001)(8676002)(106356001)(99286004)(86362001)(575784001)(76176011)(59450400001)(68736007)(25786009)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1080;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: kRIs/LtReeb+83AxFc/Y9wGDfbdxNdWg2zqOdnM8+gKQAcboqUSOjZwryXZy5Ib+tcoMQNojgjwd+2PWkPLON7y/t63crpHnJObnhjqcUxVoyubFbTtCzvD2bWmYxZqPkYjql4a8hLFRTv/y1Db8lqdLKxlTOeqflXk4SnwQXy3ckFp3odnygOkbcL2RA5kbvW6mfWVVOcPbgNpb6Jqgqjf5Wp2mutpuxFve/feoZzHEkPNhhGaNZJmorJnOWG1tbmb3nrTXYJu9fWgSBJkoP6+6Iu+miu9lSuwse+JkLRvvWTchHFhViH1g+wXzO7gBYiaYgK7AtfGBObGQhx+NEb307QrtxrRnUBc0uHCzt/UZZDY41HfKsCix3qjZ4T7KxPjUabgCc3UEegtGj5KCLj4Dn6Y1ncUaJEk8IAAoi0A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b3286d9-19bd-43e7-1d69-08d59db0268b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:20:39.1754 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Prashant Bhole [ Upstream commit 783687810e986a15ffbf86c516a1a48ff37f38f7 ] Bug: BPF programs and maps related to sockmaps test exist in memory even after test_maps ends. This patch fixes it as a short term workaround (sockmap kernel side needs real fixing) by empyting sockmaps when test ends. Fixes: 6f6d33f3b3d0f ("bpf: selftests add sockmap tests") Signed-off-by: Prashant Bhole [ daniel: Note on workaround. ] Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_maps.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selfte= sts/bpf/test_maps.c index 50ce52d2013d..8b9470b5af6d 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -463,7 +463,7 @@ static void test_devmap(int task, void *data) #define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o" static void test_sockmap(int tasks, void *data) { - int one =3D 1, map_fd_rx, map_fd_tx, map_fd_break, s, sc, rc; + int one =3D 1, map_fd_rx =3D 0, map_fd_tx =3D 0, map_fd_break, s, sc, rc; struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_break; int ports[] =3D {50200, 50201, 50202, 50204}; int err, i, fd, udp, sfd[6] =3D {0xdeadbeef}; @@ -868,9 +868,12 @@ static void test_sockmap(int tasks, void *data) goto out_sockmap; } =20 - /* Test map close sockets */ - for (i =3D 0; i < 6; i++) + /* Test map close sockets and empty maps */ + for (i =3D 0; i < 6; i++) { + bpf_map_delete_elem(map_fd_tx, &i); + bpf_map_delete_elem(map_fd_rx, &i); close(sfd[i]); + } close(fd); close(map_fd_rx); bpf_object__close(obj); @@ -881,8 +884,13 @@ out: printf("Failed to create sockmap '%i:%s'!\n", i, strerror(errno)); exit(1); out_sockmap: - for (i =3D 0; i < 6; i++) + for (i =3D 0; i < 6; i++) { + if (map_fd_tx) + bpf_map_delete_elem(map_fd_tx, &i); + if (map_fd_rx) + bpf_map_delete_elem(map_fd_rx, &i); close(sfd[i]); + } close(fd); exit(1); } --=20 2.15.1