Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3440768imu; Sun, 11 Nov 2018 15:09:28 -0800 (PST) X-Google-Smtp-Source: AJdET5fYcJDoF58AFev+vPImCwJbnoNk0XcLrLFekdpf+bvo+6xcx81YX22vn/saAB9zqgDbpq9n X-Received: by 2002:a17:902:bd96:: with SMTP id q22-v6mr5484839pls.167.1541977768805; Sun, 11 Nov 2018 15:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977768; cv=none; d=google.com; s=arc-20160816; b=i0UDHs7qC8mA7U5Jv/fD47kZFu4U0f3iT9q47hJIBRc1XupTgJAY1Gq3c/kCThJhgP 5AQEntWedQ2J9UXEsKiD9ZE9GZQBuhp7r/HkAawz27CbpSHsmEkRH0UwJVGOlmKmKVVF bfs86I3Xlk/JF33J1q8wxzzMqzBqrBGCS1mrpM5Czale8WXRjmSh11WU74slvLIFAKUq b0bvse3hrHVF6oYWHNBzk/kUDT/nq71Q0SNNzwolNk73kj4yrxO/0H1Hj0t8oPTrovPj FE5czgV8GUuf7G6Y2gp70PTeOuU1ozr7chygDby+jubNaYrHfPwrQ21hoJDLlCSPaMJe rE6Q== 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=hfFmURo1dBJWgOf3jVVgiKPwLPUSixJZB3lH9e0ha5w=; b=VJgwiQ1Rs8ByCeaogOgDmzBTABwnuWSILxwf05CVsCvDtDHacqgIcrLZG8sq7l//1J 1X2WcsoSYO4pxHrL50l1R8WNVYq1gUe3vY0HQEMQWQPWLKXxqH3h8V+Aywy+OeFyXdjo GJJG8J7+sJKxXOrjHhSluVP0jcOArxKtGB9hcz9a5GRuSuMgbNjVhUkVBflVvevnETSc jpaBWXoPduMDE+vQn0Jc2IodcXui8bE6jZLTvwWDSZOl5gdfjirjDdm5FY989yufQhQT cqcDIX6JXVPx5o8NYmBsdlyKNB2MFhZ7tqIOgKIdLjw5VHXWtcU6rFP8QJlXpDTFYsgt J2uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kueWqD52; 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 h5-v6si17046895pfg.226.2018.11.11.15.09.13; Sun, 11 Nov 2018 15:09:28 -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=kueWqD52; 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 S2390576AbeKLI6Y (ORCPT + 99 others); Mon, 12 Nov 2018 03:58:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:51334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390259AbeKLIWG (ORCPT ); Mon, 12 Nov 2018 03:22:06 -0500 Received: from localhost (unknown [206.108.79.134]) (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 EE48B22419; Sun, 11 Nov 2018 22:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975529; bh=kUi4FDpsG4mMwQkvByqDgh6mInbCKp9dHHx7ZIgfHq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kueWqD52CGKR7IAbh218u0wrvETECmGz96Vp8tzorAVOLTvux/RhzYBqeUFqCB+ia RkfGE21ZEuKoD8RcKLBwhjbnhoNfxD8b0cRISzhwLobqR3qQda1/bymXLZDcyQZeFQ FdDvIpUHF78WpwMn52wzWzLyRxhjeJSwF/6YScl0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Sperbeck , Eric Dumazet , Daniel Borkmann , Sasha Levin Subject: [PATCH 4.14 025/222] bpf: do not blindly change rlimit in reuseport net selftest Date: Sun, 11 Nov 2018 14:22:02 -0800 Message-Id: <20181111221650.511209939@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 262f9d811c7608f1e74258ceecfe1fa213bdf912 ] If the current process has unlimited RLIMIT_MEMLOCK, we should should leave it as is. Fixes: 941ff6f11c02 ("bpf: fix rlimit in reuseport net selftest") Signed-off-by: John Sperbeck Signed-off-by: Eric Dumazet Acked-by: Daniel Borkmann Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/net/reuseport_bpf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -437,14 +437,19 @@ void enable_fastopen(void) } } -static struct rlimit rlim_old, rlim_new; +static struct rlimit rlim_old; static __attribute__((constructor)) void main_ctor(void) { getrlimit(RLIMIT_MEMLOCK, &rlim_old); - rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20); - rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20); - setrlimit(RLIMIT_MEMLOCK, &rlim_new); + + if (rlim_old.rlim_cur != RLIM_INFINITY) { + struct rlimit rlim_new; + + rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20); + rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20); + setrlimit(RLIMIT_MEMLOCK, &rlim_new); + } } static __attribute__((destructor)) void main_dtor(void)