From patchwork Mon Jul 31 17:53:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Semwal X-Patchwork-Id: 109040 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp494989qge; Mon, 31 Jul 2017 10:54:21 -0700 (PDT) X-Received: by 10.98.65.220 with SMTP id g89mr4839256pfd.122.1501523661779; Mon, 31 Jul 2017 10:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501523661; cv=none; d=google.com; s=arc-20160816; b=pGq6433ck8WoB90NyCOLz18S8Ev6E9BY1wqqGXMoll4rNKNVHVcf5YVtLgMsGmddLz DJ+VmlRv1+PIqnBIogjR60yxf1nvBEgJFQGTuLr9smEz4QPV2b8/Hk9mu8EhuVZyS3E4 gJ0it2LqHQMctM7kiBHNRkcprWk9c5pVio3lETw0gJiqgYnLTHhC9wR42cIxEnMNFav1 p+KeuJtyp6DqUO3mZatV8iFFDP+w3602UM4GG3ZAFn3jg09M9B9rSn8PX6Mcg4gpXYuD ysb0KZMyrVP8AOIIjQ3TztwtvieVI6BKhcOX3oklQukKV33Fp4vUzOOpelAEbso2p/I0 JmvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=N0LQwrXsz9nTASLlx2yZmykT43EVC5VDBLpZld9Xti4=; b=LXR2ej2O6t2ukgLnAjLAwhoz0l0ohekuWIdk7Te0PzF2DXvVWzYie8CABsxaIqC5jb sRcMXfUIS3ElM3h5oeEZl+ITQRCeYUUqZ3hDe/NS0XBpqDSlq8M7+DWKFFKV2P8oM+in VnpdEF/A0cm4dVwHP5PT4IW2/mJM1HHnUCgp5LKWC37wc7WzMlDkFybKuXZpTbM+rytq GGA/t8CAzaGI1PWZbt9SkNJVdWxGnPttonng6OybW2EqFauJA2+9HrNbRkTmIpQKao/L liXiAWCQ13dqKgsqGmLIIrXAfO6Z5XL4QoYCbu9hYIj6gUSMbHUxsH/1gwbd8yyzBXm0 +f6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=fipipyU2; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si17444585pln.785.2017.07.31.10.54.21; Mon, 31 Jul 2017 10:54:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.b=fipipyU2; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbdGaRyT (ORCPT + 6 others); Mon, 31 Jul 2017 13:54:19 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:36549 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbdGaRyR (ORCPT ); Mon, 31 Jul 2017 13:54:17 -0400 Received: by mail-pf0-f169.google.com with SMTP id z129so84365589pfb.3 for ; Mon, 31 Jul 2017 10:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N0LQwrXsz9nTASLlx2yZmykT43EVC5VDBLpZld9Xti4=; b=fipipyU2r/mDo2Qa0lOabIKRf3aX5Sq6zVGs6qG8SLiUbkOOq/unqJC0SohJxPn/mf OCtudQQAOep64Evs9ghoKRMpVQkX59K+Grcy7iPwDMjWj9XqfGFe843VXLu07rnEDON7 GAzYd+0Mo+QwQ9+jLCEJ3J/6MXu7CaiuRtqh0= 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:in-reply-to :references; bh=N0LQwrXsz9nTASLlx2yZmykT43EVC5VDBLpZld9Xti4=; b=QEV3tGxAKJKOjp14X9fqx0BFYjI4tXUEYmC4AQxYBvMX4W0IOcEoAoK+TPjV6pVn92 RAlHP6TSHvOgchuSFhJgqUG+24Ntjn34jWEg5pOBuHxE4jAgfsSn4UqJSCZTXHknbsyO pmY6vlI0o7iLnHngRhHQOxbNM/DkfQHY98dGjGIm/vS1VaznuCcUDhZ7C+mvuFLVYNFP bs49QFgbvfbg6jsUS1pzNXhJwqO8vv7LRTkOUN7Uj6/S3z6KEfoazP/onJxT3YT997u1 1AcDr1ww8cP1H3Fn6RQE9r1q4zDVBjcIoE1guUKvVyYqGzePPPdsgK8v/UMwS0uT0iWN DWYg== X-Gm-Message-State: AIVw110Lgxd6peOxm0On9hSDmKKH6x0tIMUNyYbTvoCF+zuBqPzel7OL qYtdeaFQ8J33mcheUlsggw== X-Received: by 10.99.102.68 with SMTP id a65mr16137644pgc.252.1501523656077; Mon, 31 Jul 2017 10:54:16 -0700 (PDT) Received: from phantom.lan ([106.51.116.52]) by smtp.gmail.com with ESMTPSA id j29sm62148749pfj.68.2017.07.31.10.54.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Jul 2017 10:54:14 -0700 (PDT) From: Sumit Semwal To: stable@vger.kernel.org Cc: Linus Torvalds , Sumit Semwal Subject: [PATCH for-4.4 2/3] /proc/iomem: only expose physical resource addresses to privileged users Date: Mon, 31 Jul 2017 23:23:30 +0530 Message-Id: <1501523611-18222-3-git-send-email-sumit.semwal@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501523611-18222-1-git-send-email-sumit.semwal@linaro.org> References: <1501523611-18222-1-git-send-email-sumit.semwal@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Torvalds Commit 34dbbcdbf63360661ff7bda6c5f52f99ac515f92 upstream. In commit c4004b02f8e5b ("x86: remove the kernel code/data/bss resources from /proc/iomem") I was hoping to remove the phyiscal kernel address data from /proc/iomem entirely, but that had to be reverted because some system programs actually use it. This limits all the detailed resource information to properly credentialed users instead. [sumits: this is used in Ubuntu as a fix for CVE-2015-8944] Signed-off-by: Linus Torvalds Signed-off-by: Sumit Semwal --- kernel/resource.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/kernel/resource.c b/kernel/resource.c index 249b1eb1e6e1..a4a94e700fb9 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -105,16 +105,25 @@ static int r_show(struct seq_file *m, void *v) { struct resource *root = m->private; struct resource *r = v, *p; + unsigned long long start, end; int width = root->end < 0x10000 ? 4 : 8; int depth; for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent) if (p->parent == root) break; + + if (file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN)) { + start = r->start; + end = r->end; + } else { + start = end = 0; + } + seq_printf(m, "%*s%0*llx-%0*llx : %s\n", depth * 2, "", - width, (unsigned long long) r->start, - width, (unsigned long long) r->end, + width, start, + width, end, r->name ? r->name : ""); return 0; }