Received: by 10.192.165.156 with SMTP id m28csp935421imm; Wed, 11 Apr 2018 09:31:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48GMQbO1F6XwC6zKI6PqL4AJ6woC0I2Hz1y8hDNTh8z6TbpvD0W5mMzMeY79O8Zg+zLoWKf X-Received: by 2002:a17:902:8543:: with SMTP id d3-v6mr5795065plo.20.1523464266223; Wed, 11 Apr 2018 09:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523464266; cv=none; d=google.com; s=arc-20160816; b=jtQXx81HKmhU1NIpuzBmvEcJssZitYthgL91RMPaKwyHsqPtOqbKCTZ/oJllp9lJdI 4D6JV5u7bGz+QFt+xPQmAa7/NYiZkbCoBbUR0nzWYwJx5i5YOiSp3chXn7sFYEipAKnc nSF+bQIL/aW41iCwLAR0rBplaKCneE0RSujW7wwlNicvgLNnZlQ8Rqa9Z1FVaktPvTIv CiaBP9u+sv17WHvMUEogJF4meTVvWF2AmFr+F1vYCgmpOSexvSdifesynWXYtrDIkZST bkgvT8E4b44UlG5k1EVG+a1GynmKC0Ami3Q/dkAbRt5LRwkX2mTW55Wc5ShL0lBfprTD cE4g== 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:cc:to:from :subject:organization:arc-authentication-results; bh=d1tjw0dKxUm7BcRQWUCZ++Tvm7p7mX/xd8+BAH1vTx8=; b=H4wyTdl/bBb3N1i8YOt6A7ynMZxa3U70jHPWGh9UGoiE4N6m2YeM8hvKe1IXJZBgRI T7RHp7IbuXZCiSUVvCbBcCWk6xk4nLPk0t5uGo9kAA8FoeXqZxquQh4MVeRXJxkuZHj1 Qz31+ptoW2cEVnVnd0lhUdr2mEQf4Z+QCahslYKERKrSlOnkCPF/mDgTBzDiurIITapQ jH1+cWuXcsGD7rH1ck8tCp6MWDg2MHOwCG8hAvZHeT6+7kYl5J6VY6CYX9DNEjLjev8K RG6Ylw3mOtCwab3BPQUWoV2zp5EMBhhyylxyhq2ORMxhQEKMBaelp8vFzmbhpAvYfJ3C eSyQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 186si965752pgi.821.2018.04.11.09.30.28; Wed, 11 Apr 2018 09:31:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754401AbeDKQ1P (ORCPT + 99 others); Wed, 11 Apr 2018 12:27:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54414 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753651AbeDKQ1M (ORCPT ); Wed, 11 Apr 2018 12:27:12 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B1D9406F890; Wed, 11 Apr 2018 16:27:11 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-8.rdu2.redhat.com [10.10.120.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DA282026E03; Wed, 11 Apr 2018 16:27:10 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 23/24] Lock down perf From: David Howells To: torvalds@linux-foundation.org Cc: linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-security-module@vger.kernel.org Date: Wed, 11 Apr 2018 17:27:09 +0100 Message-ID: <152346402954.4030.7078270243543630603.stgit@warthog.procyon.org.uk> In-Reply-To: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> References: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 11 Apr 2018 16:27:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 11 Apr 2018 16:27:11 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Disallow the use of certain perf facilities that might allow userspace to access kernel data. Signed-off-by: David Howells --- kernel/events/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index fc1c330c6bd6..1922f2e0980a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10407,6 +10407,11 @@ SYSCALL_DEFINE5(perf_event_open, return -EINVAL; } + if ((attr.sample_type & PERF_SAMPLE_REGS_INTR) && + kernel_is_locked_down("PERF_SAMPLE_REGS_INTR")) + /* REGS_INTR can leak data, lockdown must prevent this */ + return -EPERM; + /* Only privileged users can get physical addresses */ if ((attr.sample_type & PERF_SAMPLE_PHYS_ADDR) && perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))