Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1361551pxj; Fri, 18 Jun 2021 05:38:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6yUmfR+VamuHcVA2+LnmIIYOqG2+HXmAEXgzfRiZ5K4A+pTFPwK5BWQ10LHh33uvj3s2Y X-Received: by 2002:a05:6402:1a38:: with SMTP id be24mr4742720edb.243.1624019938148; Fri, 18 Jun 2021 05:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624019938; cv=none; d=google.com; s=arc-20160816; b=SKo3Xx9fyZHdyzEKPELqhQUORSqkGL7LzBvCq+xet0zwN1ykFDnv9ZWkI9Ymu11P4F vnaEVCa4EjqN/PQ+p/qtRI0yR1qlQ9oQ07CmDbPo2N5u1gH0SeGgTIG01W2ok+p+pZPf BV4GYe/Epg2YroxcPerDKJ5D9zgceuoy5DaXA6Sk6B+OJAgFzeEscdwm/F+ckLtn7fqm OLh2cL3zSVVdu7cdmfOLo47i9lKiERh2Yebd3NqubWfdUia7ca30zqTjfRuQuNlmNZch ARdEyi5S3Kvzm2HsEGeXf71JMACeFELd1iV1ZxxvPw+QbA9I+OQ+RKZIB8mRhbAlITai +g3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z+Lt9uCVLmu8+kIm3gV6NL1iTkcvcppxfgXT24ufRMM=; b=pgY/29fJSRRwfAdYdcenu8CPDQGYZx8NhAQnoZ1HY6tQXYNpa8nsq9Kc0b/YtDsg/+ riMTo5ljZ+9QHROQVt2zmTnpUHV8zP00OFs92861JWioXtUdBFk9+Nmr25KAqmdQthtT thwm1ybVbLsSNK9AlAtKdOkTDvd+AHgVNo8HDTw/LUTLGjDR8jMYDfTN7edCoBqgOSIs 4QwltBEk6kD376pznTi8tF8PGw/MsmMWjhOOxkkXTkZA3BWnVWJqnHxxmD0w1lJaaFyh V4RiWVr6ENuNgWh0bGMxv2N7TNbu+5sqqDo9X+dHkbcPu2ZjeXyTKA3kjG0FAEY0Q31E HBxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LsFlCaFq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si2142916ejd.416.2021.06.18.05.38.35; Fri, 18 Jun 2021 05:38:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LsFlCaFq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233809AbhFRK5x (ORCPT + 99 others); Fri, 18 Jun 2021 06:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbhFRK5r (ORCPT ); Fri, 18 Jun 2021 06:57:47 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D967DC061574; Fri, 18 Jun 2021 03:55:36 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id 13-20020a17090a08cdb029016eed209ca4so5655556pjn.1; Fri, 18 Jun 2021 03:55:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z+Lt9uCVLmu8+kIm3gV6NL1iTkcvcppxfgXT24ufRMM=; b=LsFlCaFqS8uvZUfAHKKZ/mz0Zn68hVxj81lSvCYXrKbluGdVs9mQ6kWinE9Z/UCe3X ZoelfObearC/yyo3QAisi6jTXcjU3Dxjay7EBJKg/j0IIbjFSDeb/4Jnh82CfixCfkmt DrxtixWJoOWgeWp5HDbsf5kg6s/1HGtx8roNt1ACn3K+39yo+nhrQEgHogW8Mk3jGmBh RwuSYTLDnRp6XtZfU/KJSEfeZAnWgYV8M4B0U78tTYnWUMFe7CM1F602voZFRkvqTjVD D7Q5WL/6p/FBzIVlxKF0G288YgOyeYQRV7ztlb+i1ZEkgx4312KnfuKPIjYbW98rMr0X Kcew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z+Lt9uCVLmu8+kIm3gV6NL1iTkcvcppxfgXT24ufRMM=; b=Fhh+28KUG8KvaGH97Ls6f3SGvdzIT1EoUcuKfZdOR6kcFURYXnEM0vDRyEPO8olhC0 XRkVIFsalQ/s7KWEGqsojHaZdnWsE3bfUi/IHuhoNM4AbKHcOkGZnBpLv2FHNcl3KrRF /j3v1uv68J+R+k6LyHiVrbnD2RPGme+bJM2nLz+lAENfFFzRv/00tibYYfwYILYkl4ya EVsp51rGQT4wvmIXSrpAXqicvgj0smRFQvZdKslEg/YLlfmiyiRxwsrVU+kpEIBtcFRH 2kgrk4beirAWJwByWbeOIM6E9SXoQJFDfZyToIDziR84oYirIVfd7BMREaGjaOpnF/ax klFQ== X-Gm-Message-State: AOAM530ggE7fhEheCve5r2VWhX//LKsZ/+g5VliAYFRNdr5LlUH+Hq1g vPdWMMLeIYEF6MbLE7+NpHg= X-Received: by 2002:a17:90a:4414:: with SMTP id s20mr10248080pjg.81.1624013736445; Fri, 18 Jun 2021 03:55:36 -0700 (PDT) Received: from athina.mtv.corp.google.com ([2620:15c:211:200:37fe:3511:289c:b90e]) by smtp.gmail.com with ESMTPSA id r10sm8827701pga.48.2021.06.18.03.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 03:55:35 -0700 (PDT) From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= To: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= , Alexei Starovoitov , Daniel Borkmann Cc: Linux Network Development Mailing List , Linux Kernel Mailing List , BPF Mailing List , "David S . Miller" , Andrii Nakryiko , Greg Kroah-Hartman , Lorenz Bauer Subject: [PATCH bpf] Revert "bpf: program: Refuse non-O_RDWR flags in BPF_OBJ_GET" Date: Fri, 18 Jun 2021 03:55:26 -0700 Message-Id: <20210618105526.265003-1-zenczykowski@gmail.com> X-Mailer: git-send-email 2.32.0.288.g62a8d224e6-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maciej Żenczykowski This reverts commit d37300ed182131f1757895a62e556332857417e5. This breaks Android userspace which expects to be able to fetch programs with just read permissions. See: https://cs.android.com/android/platform/superproject/+/master:frameworks/libs/net/common/native/bpf_syscall_wrappers/include/BpfSyscallWrappers.h;drc=7005c764be23d31fa1d69e826b4a2f6689a8c81e;l=124 Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Daniel Borkmann Cc: Greg Kroah-Hartman Cc: Lorenz Bauer Fixes: d37300ed1821 ("bpf: program: Refuse non-O_RDWR flags in BPF_OBJ_GET") Signed-off-by: Maciej Żenczykowski --- kernel/bpf/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index b4ebd60a6c16..80da1db47c68 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c @@ -543,7 +543,7 @@ int bpf_obj_get_user(const char __user *pathname, int flags) return PTR_ERR(raw); if (type == BPF_TYPE_PROG) - ret = (f_flags != O_RDWR) ? -EINVAL : bpf_prog_new_fd(raw); + ret = bpf_prog_new_fd(raw); else if (type == BPF_TYPE_MAP) ret = bpf_map_new_fd(raw, f_flags); else if (type == BPF_TYPE_LINK) -- 2.32.0.288.g62a8d224e6-goog