From patchwork Tue Dec 27 11:51:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 36833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1353484wrt; Tue, 27 Dec 2022 03:57:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXvuLLSM14K61OVez776NM9421yEpJlQDBUV0+xv2JD2kDKNfiKvJoVv/xRXpve9FxGy6Yn+ X-Received: by 2002:a05:6402:e83:b0:45c:a5f2:ffea with SMTP id h3-20020a0564020e8300b0045ca5f2ffeamr27140325eda.7.1672142279422; Tue, 27 Dec 2022 03:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672142279; cv=none; d=google.com; s=arc-20160816; b=pN+qHMf3mkzbzPnsxBSAZ2mTGm50d2PvmuYMdXUnDAk/SjODzuWRZeik0N3EXxYyz/ VRtRTLL2NPqp0do0kRQMpV7ALyKmaQ69LFAySNtoAKBZB9QL6wtwngBW59SEPpr5/1nF cNng/OBkQVYo8J/bUE7slc1vTeg2orr3Q8Eh2giE/wrR4aSgrlTmPJp+Zq6tPhYn4HPH lzDRqYBc3LSbPbEkLbU90sG2w/1Qp9LrRqT9pNXR9+kKXbO2R5V41DOxiGSSYbh1IxAf 2dM7z3rF4CKWB4u8ioELW+M9pc1n+vp1CWsmbXyXF3L4TUS2JjxjgUyVizDHecPORM7x bScw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=VIquszyJoGKEfNk8Vb4fQX7sPIFWljq/kAytjP03G60=; b=cl65sAY5IFx7UtJSCVxtu5SYuBIJj6B/QE11/yPMayFJrkeoZ3CDws9RIPMZxdKNP9 QeT+eOH+G1aSbO31dS3G+owm6O9Uwd/L+5RURM9l2VwKtNnqO/3XEZQiO63+XTSP1yD2 /kEIRqrt1QLHt94Id1O5oGR8sROjpg2xGFV1+xgJFjTf6/0VatpfSribz6jsbsZb1S+U 3vjBW4lT87GSEjbufVZrcF/G9SW0gTVTWaiafUZAyBvtQiy748qwdbH+uCwdTb9j15yX EAUIeqLNlK1Wuy1bwr6QufZgjXEhrPlnIGLIG3z2P1x+Kehw+KJr6gjrh7NU5pjxc+hW 1T5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Qg4CniI4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=tYxFnqRv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a056402090d00b0046dbdeddd3asi11894964edz.507.2022.12.27.03.57.35; Tue, 27 Dec 2022 03:57:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Qg4CniI4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=tYxFnqRv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231597AbiL0Lvl (ORCPT + 99 others); Tue, 27 Dec 2022 06:51:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231404AbiL0Lv2 (ORCPT ); Tue, 27 Dec 2022 06:51:28 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB089FD7; Tue, 27 Dec 2022 03:51:26 -0800 (PST) Date: Tue, 27 Dec 2022 11:51:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1672141883; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VIquszyJoGKEfNk8Vb4fQX7sPIFWljq/kAytjP03G60=; b=Qg4CniI4ziFf3VeZBtNW7lxQ7OvksBnvneFXBt8L+qFiOPkHvCUk3iVpidiQLfqMyJ0UiY VN3Lqwh1U2+NpxnDBHq01Dgx9SmN1h3NZhm6K4mrs5ADqlkvBjjW+f+UdBfaEnqGRt9qB4 AsIdCDap3uhaAgkiiO2RXuWyMDAszJrlR3xmrra4W8FQVzL/ynig6b7NpuKZjn5knGwpeA AWYf/fqIskAitZcsQi74Eov1zudlHgswjjzzKB3wguHYzTgjQq5shc/eUfOP9+lbo+BsJz foy5gY2kqyOg4DYOxZ6VzNq+E0jv/1SNL05rPKj8fM9w4Clyz69GKOLXjRyRfA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1672141883; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VIquszyJoGKEfNk8Vb4fQX7sPIFWljq/kAytjP03G60=; b=tYxFnqRv7FCXlMo8HccNrj3Vs/ftGXAkbFFOpLvkLsKffxe1ilgjzNhdM/Mr/jAZftmn6n tAJgp0jjE4Z3VGDQ== From: "tip-bot2 for Namhyung Kim" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/core: Call LSM hook after copying perf_event_attr Cc: Namhyung Kim , "Peter Zijlstra (Intel)" , "Joel Fernandes (Google)" , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221220223140.4020470-1-namhyung@kernel.org> References: <20221220223140.4020470-1-namhyung@kernel.org> MIME-Version: 1.0 Message-ID: <167214188307.4906.2093385689566390498.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752774003481321436?= X-GMAIL-MSGID: =?utf-8?q?1753368262805879849?= The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 0a041ebca4956292cadfb14a63ace3a9c1dcb0a3 Gitweb: https://git.kernel.org/tip/0a041ebca4956292cadfb14a63ace3a9c1dcb0a3 Author: Namhyung Kim AuthorDate: Tue, 20 Dec 2022 14:31:40 -08:00 Committer: Peter Zijlstra CommitterDate: Tue, 27 Dec 2022 12:44:01 +01:00 perf/core: Call LSM hook after copying perf_event_attr It passes the attr struct to the security_perf_event_open() but it's not initialized yet. Fixes: da97e18458fb ("perf_event: Add support for LSM and SELinux checks") Signed-off-by: Namhyung Kim Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Joel Fernandes (Google) Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20221220223140.4020470-1-namhyung@kernel.org --- kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 63d674c..d56328e 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -12321,12 +12321,12 @@ SYSCALL_DEFINE5(perf_event_open, if (flags & ~PERF_FLAG_ALL) return -EINVAL; - /* Do we allow access to perf_event_open(2) ? */ - err = security_perf_event_open(&attr, PERF_SECURITY_OPEN); + err = perf_copy_attr(attr_uptr, &attr); if (err) return err; - err = perf_copy_attr(attr_uptr, &attr); + /* Do we allow access to perf_event_open(2) ? */ + err = security_perf_event_open(&attr, PERF_SECURITY_OPEN); if (err) return err;