Received: by 10.213.65.68 with SMTP id h4csp2118778imn; Sun, 8 Apr 2018 20:10:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Af2Gn79HOCq/Atrsplxdjs5K0rzKRq8bF1hCCZQyhKQ0GXxbicwg96Obh0SUrZ7VhOgot X-Received: by 2002:a17:902:b58e:: with SMTP id a14-v6mr3139775pls.175.1523243414334; Sun, 08 Apr 2018 20:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243414; cv=none; d=google.com; s=arc-20160816; b=PGzuVM9QqVu4qrImFzXhjHHPxETTVaeysFz0XSxuu5UzcCemM313iFKnqepwBYPqdX StHnzU4MGx8oguylcBjHgxDzv/JTZz6X8p+NIA3n5R2L+FqHKYwXMwBheq1NL3bL8SDt wUWTrnxBVml3RLBgwvtd1jBMbRyVmi7cXqGEyZ/6kd5nHTqAIGnb/e6rq5k8TJGyoGfQ LOPktWeY0jhd9GkAz9uzjlTzJzRzhHAf0kNxYPuGSlW/ffPthFvupaoxDGxIYywzB9U4 sJMmL8Rx/cFbM67SlsCvFuFyg4xW4ead4P5R0W7rR9czBHSH4jy6negbMSV+4oKHncbd 5tbg== 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=welqrrfh1Vp3eUKKymnMc347udvJ58E4nuahHTv1PMc=; b=ZTw/jz6sNZfiZcmmUWpHlwK2yULlvUrKy4YX0ZqKpH0XdoHPkkxk2e4/z2crrZeJFC T+eorLqMfSWUhYq4M+Qz/yH4XH921NPQ3CrHS6TN13iivOMaR+fUZD0emHsEIwRxqVSZ T16RnqJ5mg3pksgGW9RANwgmup83UYcgNKgHeT5uRaaI0TyeFKaWczgLW78Yw6FkwqSh 3V9IQIguKwtuwzNHRr1ZAZL89FVkupuwKLAKHPSLCW4pazX75j6d9VETHNkhFbz1x6np 1LiOgZp/sqayt8/WkqRlfPv+2HyoS/VioDSUuoeEzUA/Xmk0fHmcysPSW079zMT3XV/j Z10g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=OGpWPdJd; 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 w34-v6si13626954pla.319.2018.04.08.20.09.37; Sun, 08 Apr 2018 20:10:14 -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=OGpWPdJd; 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 S1755704AbeDICve (ORCPT + 99 others); Sun, 8 Apr 2018 22:51:34 -0400 Received: from mail-by2nam03on0131.outbound.protection.outlook.com ([104.47.42.131]:4960 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755345AbeDIA0c (ORCPT ); Sun, 8 Apr 2018 20:26:32 -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=welqrrfh1Vp3eUKKymnMc347udvJ58E4nuahHTv1PMc=; b=OGpWPdJdwcIsK5tiQOGLWgFD+MzmCSk5xeemBc6Ky93l7okP1XGcWrr+48gFzCdY4730LGXPRK+9lYA79gpDBDuYlWx6KltKSWfUBRX19k0RtRkD4rxBeyhZe7OVHa8eu30kC+mw7cihlfY/ps3p1plRoaLO3jQC6XWLnXGR3Ok= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) 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:26:19 +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:26:19 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Daniel Borkmann , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 150/161] bpf: fix rlimit in reuseport net selftest Thread-Topic: [PATCH AUTOSEL for 4.14 150/161] bpf: fix rlimit in reuseport net selftest Thread-Index: AQHTz5jEtetK9ctoxE6z71mMKnti2w== Date: Mon, 9 Apr 2018 00:21:55 +0000 Message-ID: <20180409001936.162706-150-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;DM5PR2101MB0725;7:MkRMoVQK6DRfZYAIXiQx0A4vcACZxlkWgOuQQlLqUL301Ye/SSGaVHCvELngahRaghuNgHJrltWtgcF980ileu+rUrlptlQpBywe+zPnG7mA3pcTkl0QXo8uxAJKW3j37IEc60/AdaK2zh/On19A/Cm/fshff4brU38kczBNpGJs/2XCaHv2iKyqHqz2Db775C2oz1zx7Z/pw6r8ypCdal7HGhNMS1FQeAn/7xerUUzWlXlHB0lhCZtckPEI9E4A;20:ONW+XC6LLIIowaG8+9GKQWE1u81zragJNj3SApXNmllKnoiGYZJaksGFMYISaNZ/XBB0q018fUKa1dadiq9YN9+mjMYeWwYYiX387TuUo3EzUArb54n7mcqZsz1S7uLolcUK6Iz4aN/CKYlj/pNwwGXM+QX9UW/SjvFECJuD6qo= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 3c335923-e9c1-4319-9de9-08d59db08413 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: 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)(5005006)(8121501046)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0725;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0725; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(366004)(376002)(396003)(39860400002)(199004)(189003)(6486002)(81166006)(26005)(6512007)(6306002)(4326008)(6666003)(6436002)(81156014)(8676002)(97736004)(186003)(36756003)(72206003)(53936002)(107886003)(2906002)(966005)(86362001)(76176011)(110136005)(305945005)(10090500001)(486006)(3660700001)(102836004)(5660300001)(14454004)(476003)(575784001)(86612001)(446003)(99286004)(68736007)(66066001)(11346002)(54906003)(2616005)(1076002)(7736002)(5250100002)(25786009)(8936002)(478600001)(2900100001)(2501003)(3280700002)(105586002)(59450400001)(316002)(106356001)(22452003)(6506007)(3846002)(10290500003)(6116002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0725;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: ExHSnKmnG/bwWGBdSAHJic6KsbjgXJX3Cw3EFXl4VA97+sKK6nSDhyQBSUx1UxeIrM5l4cRxd/Xz+plc/onrWyrnIQ4vGQUOaEwvxxT2Z3gujibFdzxQNayyF/gSqJvaE6HS++VND8Ir4q6Wqx+VicOXyh9mE+RwtMm8HUojg1KOWlyW1kCtNLS3DqoFDNQYx5s41KdY3ehufDbNSxdybStDCAcKMeWxWZnFDgWlfVzUIb1qa6b+MZMOgTpvpkOFTFUkTk/3Jw3ZNWg7u+Xf5a5VxL0EO1aZNJxL4qT7L9fsRwX2djGmQzC0BDb0XyzoEaE3zsRXAemZLuG7J9q7DnkOkGF/qbeA1rrSXOILacNbmzVVAFqpxVuOpcA7Zx9irYj1r9Z1ikIKKiZETyPAK9I2M3RRpHFhS/1e4smFZkU= 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: 3c335923-e9c1-4319-9de9-08d59db08413 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:21:55.8623 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Borkmann [ Upstream commit 941ff6f11c020913f5cddf543a9ec63475d7c082 ] Fix two issues in the reuseport_bpf selftests that were reported by Linaro CI: [...] + ./reuseport_bpf ---- IPv4 UDP ---- Testing EBPF mod 10... Reprograming, testing mod 5... ./reuseport_bpf: ebpf error. log: 0: (bf) r6 =3D r1 1: (20) r0 =3D *(u32 *)skb[0] 2: (97) r0 %=3D 10 3: (95) exit processed 4 insns : Operation not permitted + echo FAIL [...] ---- IPv4 TCP ---- Testing EBPF mod 10... ./reuseport_bpf: failed to bind send socket: Address already in use + echo FAIL [...] For the former adjust rlimit since this was the cause of failure for loading the BPF prog, and for the latter add SO_REUSEADDR. Reported-by: Naresh Kamboju Link: https://bugs.linaro.org/show_bug.cgi?id=3D3502 Signed-off-by: Daniel Borkmann Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- tools/testing/selftests/net/reuseport_bpf.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/se= lftests/net/reuseport_bpf.c index 4a8217448f20..cad14cd0ea92 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -21,6 +21,7 @@ #include #include #include +#include #include =20 #ifndef ARRAY_SIZE @@ -190,11 +191,14 @@ static void send_from(struct test_params p, uint16_t = sport, char *buf, struct sockaddr * const saddr =3D new_any_sockaddr(p.send_family, sport); struct sockaddr * const daddr =3D new_loopback_sockaddr(p.send_family, p.recv_port); - const int fd =3D socket(p.send_family, p.protocol, 0); + const int fd =3D socket(p.send_family, p.protocol, 0), one =3D 1; =20 if (fd < 0) error(1, errno, "failed to create send socket"); =20 + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) + error(1, errno, "failed to set reuseaddr"); + if (bind(fd, saddr, sockaddr_size())) error(1, errno, "failed to bind send socket"); =20 @@ -433,6 +437,21 @@ void enable_fastopen(void) } } =20 +static struct rlimit rlim_old, rlim_new; + +static __attribute__((constructor)) void main_ctor(void) +{ + getrlimit(RLIMIT_MEMLOCK, &rlim_old); + rlim_new.rlim_cur =3D rlim_old.rlim_cur + (1UL << 20); + rlim_new.rlim_max =3D rlim_old.rlim_max + (1UL << 20); + setrlimit(RLIMIT_MEMLOCK, &rlim_new); +} + +static __attribute__((destructor)) void main_dtor(void) +{ + setrlimit(RLIMIT_MEMLOCK, &rlim_old); +} + int main(void) { fprintf(stderr, "---- IPv4 UDP ----\n"); --=20 2.15.1