Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2160941ybm; Thu, 23 May 2019 12:21:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwtt6sOtycbU1NBms8xC3PazqhIYGsUvMuKe+s9IxU1awm1Wnc3N3VmElfc0JetRm1tpDg X-Received: by 2002:a17:902:d892:: with SMTP id b18mr56881688plz.216.1558639278893; Thu, 23 May 2019 12:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639278; cv=none; d=google.com; s=arc-20160816; b=rvllGFSzEFtNwlWZHwvzMh6mvueALfp4sSq+bHeiyNkGE7RA+hPrySXfZu94+7fATi K7vXX8X+EfcfFJFKqxrlBgD+sdPsZG5uKHLdyNp/QeZM2Id2PqqITz5y9l0suypJm8GL JJ9/P94ea8mvvQkgtZh03/AiMetbmzgYwfoW1DS1sBakbvkyXKCiVA2aXdR2iSIJnLNt PyQVblwNz2khJ1A5ebULVSUtLJVmXVIZ4Wy9hVLWCixJ9lKVtq83ERcHHxb0XnO1V7FN tBOXTPJt3EoPpd3IiKejfjFFcFVjJXF8KyGvGHlDl2z1vreoxrH6/Pw9JyGvrmNBF1RQ GH/w== 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=ENgkRNwFxXbNmozx2EKipzg4GmoYDCAXoPMulKKPZFc=; b=fbJb0vz0D56xwAsRE5YzrrPWFN+/ywxce701fYveP/r3ECTh+KxmYtPZxaYngGX+qU wTxVcwgltAa3wwJuAWFBtfiDOqkMqBREQaBcnVlIxs4BaUYvjiSiLuJCBshk/CKYIp0x 1uCdTueDHHVOMebGC5jfud5YRT1kK3Sn0v2NcM3RvhLaicRPtSH+9xFtqgTdsHBW0NcA VF9XTfP4IVedQaTIk7y8vEfYqtUz1MJ0uNY5uyhU31Q39zDrAcPV8H3VRT7NPeyBPB9L +pcUXDYJ55720+Y9R5Mha9c+vKdBTeABSGH1SdCiaUVp39UhJCQ7SL5CiyoHEVnth96r Aiyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IooAF2xc; 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 k14si555888pgr.413.2019.05.23.12.21.03; Thu, 23 May 2019 12:21:18 -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=@kernel.org header.s=default header.b=IooAF2xc; 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 S2389839AbfEWTTe (ORCPT + 99 others); Thu, 23 May 2019 15:19:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389828AbfEWTTa (ORCPT ); Thu, 23 May 2019 15:19:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 35035205ED; Thu, 23 May 2019 19:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639169; bh=EhYtP/rpvE8jWFvUYVqzJ7BQ2mvQOotty2PPRp7l7Lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IooAF2xcGjpdlMVWCVLqyGNkeb6s4E8E98mBU2qsv7+LNks/ylkEwt+wx86X4ZkAU bAh2bOXXN7VhUXW7l3tJB4nZ6Xk9Jp8ASLVdFl0iuOoxyqtnKxwkU044SUxLwuG7JR hDQpHvBEEYigtwqRxyYkjySVlVZbzXkZsggHrf78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chenbo Feng , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH 4.19 112/114] bpf: relax inode permission check for retrieving bpf program Date: Thu, 23 May 2019 21:06:51 +0200 Message-Id: <20190523181740.846294896@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181731.372074275@linuxfoundation.org> References: <20190523181731.372074275@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Chenbo Feng commit e547ff3f803e779a3898f1f48447b29f43c54085 upstream. For iptable module to load a bpf program from a pinned location, it only retrieve a loaded program and cannot change the program content so requiring a write permission for it might not be necessary. Also when adding or removing an unrelated iptable rule, it might need to flush and reload the xt_bpf related rules as well and triggers the inode permission check. It might be better to remove the write premission check for the inode so we won't need to grant write access to all the processes that flush and restore iptables rules. Signed-off-by: Chenbo Feng Signed-off-by: Alexei Starovoitov Signed-off-by: Daniel Borkmann Signed-off-by: Greg Kroah-Hartman --- kernel/bpf/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -518,7 +518,7 @@ out: static struct bpf_prog *__get_prog_inode(struct inode *inode, enum bpf_prog_type type) { struct bpf_prog *prog; - int ret = inode_permission(inode, MAY_READ | MAY_WRITE); + int ret = inode_permission(inode, MAY_READ); if (ret) return ERR_PTR(ret);