Received: by 10.213.65.68 with SMTP id h4csp2116246imn; Sun, 8 Apr 2018 20:07:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+geXqbUM+kqx6yvrBqghxZ4mZHkgmVkeOIk4JrR1I1mRcjg0yUHeZgxw8SbRfNV1i86gDi X-Received: by 10.99.123.71 with SMTP id k7mr12203230pgn.245.1523243223928; Sun, 08 Apr 2018 20:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243223; cv=none; d=google.com; s=arc-20160816; b=ZBCF8uR3tsHjDYpBNmTzTzwHRboKbUuZj5/omvkn+q7+nwBMvBml4sElENAkVeo84F txDHgK+syse27SULs10dVGuDBmYO/V7o9+IT3YBx9COnt+7VeWHNBeQfnaZ/0KJOscTr Al4pu9yYZnFtU8V442dq4/YxuOB9KMmyJ079YA4sGPBsW1wMF4zXN2X/n0ftZ8Q7zhRf riI1fhfyPcfIM41Ac1UfxBJcunNdSxByt0h2WJeAhYZZZPNvHtrizRzDwP3+R1auN6xB fR3gikKkfBpJKc6j9KB1ZPVOuGYGd3oMDu06AQJp84UW/pWVFikvGJezMJV8/Zes2+0Z mdSw== 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=iKj1y7WdEdjrlzNbZBsYdv5UrtIeE+0InEHk6DsKdkmpw9W4InJv3FE1qcqGR1rUYE JgYJwWGMyZi+2+BrfNjE1W1dp9cR6U0/yP4NvMlPomjfpALYBX7HfqrnD/jevrfwB+KD 5WPzNMJwiy+Rhry4w8HaFg/AMpTYeTJqJ48OyQGi02u/4oj0RBI11NK9Gaz21zHpprfE /4PnVIWX6B9FYqcKe1HCX8T3qprmrPGYZ/A4wIcldCjIBYHSV7sA4ugzz5bvog+bav9L Qi/fHdWx1I1faWqUxZLw9M5gt910IZ+lvhJkSl4OHbJnp1949eDNxSBCpobvchFhbDeX GE7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=GTDz59Ts; 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 b13si9890034pfi.53.2018.04.08.20.06.27; Sun, 08 Apr 2018 20:07:03 -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=GTDz59Ts; 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 S932554AbeDIAfB (ORCPT + 99 others); Sun, 8 Apr 2018 20:35:01 -0400 Received: from mail-by2nam01on0115.outbound.protection.outlook.com ([104.47.34.115]:46358 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754270AbeDIAew (ORCPT ); Sun, 8 Apr 2018 20:34:52 -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=GTDz59TsULqwuAshQDNb9gZ7WvCs1gt58dEL6TSLc97VgvmZVROznz3G4ibu3Vn9Z6HJ3OGeWyoPDnH4LRvKizjD4FuRdMLIQUh6NWtPSZyCv3kqk/VfQHDNIid3Kz5U5BWvKR14sqcAIvos+RRD8/iKUoihWog4CjONAfZ/wxE= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0806.namprd21.prod.outlook.com (10.167.107.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:34:45 +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:34:45 +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.9 288/293] bpf: fix rlimit in reuseport net selftest Thread-Topic: [PATCH AUTOSEL for 4.9 288/293] bpf: fix rlimit in reuseport net selftest Thread-Index: AQHTz5lu1qzGrlrE506I8dvNqoqCFw== Date: Mon, 9 Apr 2018 00:26:41 +0000 Message-ID: <20180409002239.163177-288-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0806;7:OS7Zv+HrbrSbOU+v7Fs0NGD+Bf08hkthrN6lvPVHJXcN5+xERq48T6ZWq6gjg/Z0BY3RBigJMj6C18l+towIb8MajGfWUrk3Nw+pCm0Oxdy2GUiLwVZAxvTf31QA6mjBi7sBLXVokz2MzP5S81IyJ/9IbTzIjHY56Dekm/v6a4JiiAUudbiTG/urvf2byuNVc67nyQfO9btm3gGOjFoZVyKNA8yuARGBEOhifRHcKjkWYl3GZ/ATgdJbiMKDlA+o;20:+BGnUzzgHoFY+meX+KLhEzVEyaJPfMstMinbBc8tf18YHUD2ctHMvde6cn8RoYNnHSgklTPimR3KocHDU1G0VGLD2+lctbJDgklWB0OvVcOQx5lpW6NysUl+U/KB9e0rnhCaVz/pFIh6DLgawH3PCrK6eGXVJG1x4UR7orUob0E= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 4ab14cc3-6879-46c2-cbf9-08d59db1b16e x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0806; x-ms-traffictypediagnostic: DM5PR2101MB0806: 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)(93006095)(93001095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0806;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0806; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(39380400002)(199004)(189003)(2906002)(25786009)(2501003)(10290500003)(476003)(11346002)(446003)(97736004)(5250100002)(68736007)(2616005)(102836004)(6506007)(59450400001)(3846002)(3660700001)(486006)(3280700002)(305945005)(6666003)(99286004)(5660300001)(76176011)(1076002)(186003)(26005)(7736002)(6116002)(81156014)(81166006)(86612001)(4326008)(105586002)(10090500001)(2900100001)(54906003)(22452003)(316002)(36756003)(110136005)(107886003)(8676002)(6436002)(478600001)(53936002)(66066001)(6486002)(6512007)(6306002)(575784001)(86362001)(966005)(14454004)(72206003)(8936002)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0806;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: K4t4qjeUxT2cMYHQ12+iw78PKQN0Qy2Mac4t4SA+I3PVJSgT6g/rn2WU0CCyhQUkmVSifHpCAJrt2TRKPYU/G4MXRZbSSnO+lKEMhUftsTsr1PSv4uHGNh1otrljf/1LJN5aondLfJRdqN5F71CUNQ3fdZpVOWSLi6QqwizwtfuZ8F3kvqtUZERu6tzEJY5YK4NccxZJcDAp0TESY7Lh/Q6QP+Z2qohCD3Lfn+4C63EpQHZqDtES2dUcR7IbNmU5rHO0EhX6RaVk7YdLqlmUbUg7ElwmIEkksOSO/bdPIS+ctKBFTmJZqa2/cfqPbZc2oMfyIcZxYEcabir4SGzkNLz1SKP/oV5w759IipGRKPxS7a2cSNpviV+Z26MbnC5+N9d0HuSPgwLtAXAMIjM7+5hKWAgkPWnQRHt0T5j6GD0= 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: 4ab14cc3-6879-46c2-cbf9-08d59db1b16e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:41.5822 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0806 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