Received: by 10.213.65.68 with SMTP id h4csp2151766imn; Sun, 8 Apr 2018 21:02:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+0yIms+nCoZ+dN9gQW7FGbwT1uXc2VFijvh4mKSre/x4p4Z01YacdTdYWIU4aWN7Vccs+X X-Received: by 2002:a17:902:6e01:: with SMTP id u1-v6mr36490720plk.96.1523246573177; Sun, 08 Apr 2018 21:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246573; cv=none; d=google.com; s=arc-20160816; b=Tyqecl2FHEzW6/sq2fdivsb40KuAZlP7EhHjHXh+6dC+rUanR7hFbCwF47y8Tx3il3 ienpCq5FIxMRqXwFH3YrLM7gpNEVaqOXTrdEnGEJ83I+3CVo29+Uc/pgKZ88IiIpabAs Nk4s4+JLEW1Wci8Jts+2MPZqT69gUy6xGfUjTZJtY7CDu3Jz7H2kznmHAiu56TAqI05y 9O9Pc6zSc7htjnNGuImFp/dawyvrhETLsftcf+Vb0DnPEmXk6aN5pGSA+Q8pioeTXulq t8Oh/64/OW5u5UyInI2Y0BWyM1gVbXyX4Y7Q8wE7T8Ivu7a/VtjaurtOa54wQqJiJR+o poow== 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=l7QLeaZOp2MGIRf37C/5jbE6fbuU79IIZD7eQShu9rU=; b=LDH10qHbFl/mMRZoBBtzqNzJmbN+OjwOjok049Xfk4xgWwPMo82xJE9zI6tYpiZeLP cxnDU1+KpxEU0rHedTWVIR7xRcC2mVYVSeTMGMNxYGUEKiIHSn3kFjA97xr8ekXXM7EH Qk0xKaNTHHljaDHbpRGqD/mdl0SjInsxVN73FdPk7Y8Y5HX3jAvgRa+U5LC84waeB+fr 9Y7JsKZTnUUE+qpjKPATFvBjvcRD9vflElpHszZwDyv6TiBLVZRb5ZbtlNkd+eqfvLk2 Vxqitph+ZR9LRkwRwYX2v3YwEqeNCX5aHtW+t1u8U2/EYXy7QlAyV6k4WWKlZTn+3aus 5N2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=erz3rLZw; 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 g15si10507444pgf.541.2018.04.08.21.02.15; Sun, 08 Apr 2018 21:02:53 -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=erz3rLZw; 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 S1754561AbeDID5J (ORCPT + 99 others); Sun, 8 Apr 2018 23:57:09 -0400 Received: from mail-by2nam01on0126.outbound.protection.outlook.com ([104.47.34.126]:59343 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753734AbeDIASn (ORCPT ); Sun, 8 Apr 2018 20:18:43 -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=l7QLeaZOp2MGIRf37C/5jbE6fbuU79IIZD7eQShu9rU=; b=erz3rLZwirIZ4ug/DY2fny1+w9E4cvsgE8TU//2OLDneD1YTMJhNCZxE5CyLHqrRq+BS9/lY1Fn3JtT/p76BeISiU0canrQ0EukQijtRnHXKqC0F5IWvqwKHAMOHvY7PHFh937sRR3MdaU7OE7HHn60tzxcXbjTK+Gz/wR5Q0LM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) 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:18:36 +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:18:36 +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.15 077/189] bpf: test_maps: cleanup sockmaps when test ends Thread-Topic: [PATCH AUTOSEL for 4.15 077/189] bpf: test_maps: cleanup sockmaps when test ends Thread-Index: AQHTz5gvY6+/mPJBP0SkasRQdlmrPQ== Date: Mon, 9 Apr 2018 00:17:45 +0000 Message-ID: <20180409001637.162453-77-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-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;DM5PR2101MB1128;7:lmQESi4yIS0q3H9KDpdBZrtMWTtdoRPdvVBJlqqpz8oKz0qPMuzoN8PiwOwNurimBL1pNToBQ7SZdd54gri/bbDeKVyOyWpZwcEd2bfJUpAtRQK6Cr27c4NmMY9AJcNJbDcf/FEGwptP+FDzumerwKy/7VUcpiZx2oH+nPMQ4ptuStJNXTuxdNB+beRhQ8nKjeGityOMUG3C5BUK3ZJ/8od/kSQBX1/dlaiOqXGHQN1b65dA5K18YjG2sjLyyv76;20:9Wv3iQ1ZHwGCcLeGewyRHgWUimkVcURSdRIasuWWBnSEdsfX44cTS2QJDFORoDzNopArk8CLmw51gfflUDnEHp9k5GSudfp3d/IgeJg0Pt65NXcYS1MJjOl5cTVxftfhcd5bMm71Aopd7NpsgL8ehuxi3dFRZ/cdSKjkSba5+ko= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: f0553a64-07e5-49f5-d53f-08d59daf7011 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1128; x-ms-traffictypediagnostic: DM5PR2101MB1128: 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)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1128;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1128; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(396003)(376002)(366004)(39380400002)(199004)(189003)(66066001)(86362001)(59450400001)(3660700001)(3280700002)(2900100001)(25786009)(36756003)(6506007)(76176011)(2906002)(6486002)(86612001)(99286004)(102836004)(1076002)(7736002)(575784001)(97736004)(2616005)(446003)(486006)(11346002)(476003)(26005)(305945005)(6666003)(6512007)(4326008)(107886003)(478600001)(6436002)(5660300001)(10290500003)(5250100002)(22452003)(316002)(105586002)(186003)(8676002)(110136005)(54906003)(72206003)(53936002)(2501003)(68736007)(14454004)(6116002)(8936002)(3846002)(81156014)(10090500001)(106356001)(81166006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1128;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: 1dInFrmFqx3WPmuCid8kOJCGoPwtpdbCyx6x5whSrCwZjvsrwwEGsJAG4nfZnRKxdu1Oys3uqqUk93rmjiAFvyl8/cELsUqb8jKGJfOYyvA+Dbtom59Zm7B4vXmczSeW1rt3h8ZVjI/pNKCM53OmXDsQg8XP7M3Zomj2SObRjvZDDf13FsJk/RpOzwYpy7bK3L21tRLMZXy7hkpIrm51o2QY/pQlSElc0Qk4ZfTn7y9oWvNKpGAqNGJLBXw//CM4IjP9BCpY117bk6uEvB7NKZ9Q8BaR6MYoiQBFcSw3ZQlEjEYZlTKHJVxos5AAoaaFtRCJ6ou9Ou7eXsSrsjSTgzSXIV/uXGUTG/a1vnREJA3S8306HG4fN/WTIvGTr740aHEA19FT6tx1bnCmNUE/6O8PEj7JAAZ9hCKObLqWwzk= 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: f0553a64-07e5-49f5-d53f-08d59daf7011 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:45.7268 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1128 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 040356ecc862..5fb1355f80fc 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