Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2483463imd; Fri, 2 Nov 2018 12:11:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5cN2b29Aw2u/UPPzCvUkLWnn1aFD8DLPJ4fPOPOtIeu39rJwyZUi+mKxcMEinGGv1eYlza+ X-Received: by 2002:a63:bd51:: with SMTP id d17mr12200783pgp.443.1541185890861; Fri, 02 Nov 2018 12:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541185890; cv=none; d=google.com; s=arc-20160816; b=ItFrwyf+KwO8I0eGSHdtTiGpVt60shu9dmuFsVrAYghVenop4TKNViTMegCRMNVllu 9MZmPV+gMAdkLvYN6pEiNlKCR4EUepIvMyD5CDleHGOgACu1p7dIXkEEcmtK6IvRZdne K6D/nfu5DN8XX0y3+2xt4o8jvTNVlBUK/ZFdblq+IjnH+FponBIXSxkWGDKVTrn6/ldI +pI+aR93Y7/jDO73YjOQn91TfLpvhymcB3ImyuAefKxs9zJ30eyDDpV0X46R7D88pgrH +bT+uViA34hg2wfOsPXsbd9bmBpRYJgsHyBShp87oDtnV4H5lgS1fc+Dho2XwcT7tSOW X50Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=k4pvQxbFZYb3iNXjmM+O1DlOw4HWMl6dcpFYLa32pvM=; b=lHAbMYUZptPLyi4Xg5+ILrZBZQKPRGO8UfwdBTdGPpI1NZtw9Ed1+2eRSq5ewcSdFH bBRsvPZ9ByRqsIHOQkazjIjjlPnW4TxTwkDQdexAzYAMcTv6qtr9gPLdRHYIaL6048tO ugBG6kNcXDfxx0J23HJRZpSB30R6Sz0Wmxa+lqxlG/GtvZDtDybibZJ+jYy6SND7T6Bv jMlDniGja6C/8blkVuBT8dIIrHj08qj4Lw2EvOC1ZuxslBTYomJcEqeuIUJ+Y5w4Gpft XtAoeCNRa6R1cclmflsUdjyNT82O5PwtFvdAfwO/ZH86ptHoPzCkYgZa37ULvtJKoW0E dKsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=Jw14A603; 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=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si34340164plr.267.2018.11.02.12.11.16; Fri, 02 Nov 2018 12:11:30 -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=@android.com header.s=20161025 header.b=Jw14A603; 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=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbeKCETR (ORCPT + 99 others); Sat, 3 Nov 2018 00:19:17 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36427 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728332AbeKCETQ (ORCPT ); Sat, 3 Nov 2018 00:19:16 -0400 Received: by mail-pg1-f193.google.com with SMTP id z17-v6so1382605pgv.3 for ; Fri, 02 Nov 2018 12:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=k4pvQxbFZYb3iNXjmM+O1DlOw4HWMl6dcpFYLa32pvM=; b=Jw14A603Ee/r0QV5vxDQWv+bRhxoQFzuM7WrTDq+4uYPwk8VXFjMOeqvD+olvokseS c919bZugJxDVClSfLXPoR9WcZWdLBUV29gU9L87PuKmz51DWVvbvJpRRAvOujONraPr4 9BGvwFtVq1df5UlDE70lXgS7avhng2fEMIoCbs9JjpdaPjdrDeZdyDgXDx2HvPGjZzrC +NsAQ0n6gCqvxQtTD8S8Jemwm6x06HQ72QdPWoa/KrTw+uj1wKfmkeJgQQ/3e9ne0gdw EwyKrwBGpcusStpXniPHqm1JOSGy1MmqF9sTJ0pp2s7SbKEjrynJ1cQK8yxl0Qc5qxLg id8g== 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=k4pvQxbFZYb3iNXjmM+O1DlOw4HWMl6dcpFYLa32pvM=; b=t82Kbg2uA2aTlwNJYtpvBArVYruxgDGJbs6yHU2HJaj0pdtc1PsQOnYdNA2OuqFYC3 cI6siHTgQBTyK3bt918HNKDH80bhGIJhsPFvYfyGuS22DEDDKOvn36868ze4sS/LyaOH mwALh/hERXRPjkUWQaiE51FY6RZaP1fL5B4KUSUmiGv9r4zuDZOIpyhgpGmx7SAWR7cc sqQCeRrC5sasNmW/Oy7Go/HJhNSABCUoWI9uTggg5/cU+0qgG62Taz6yU2cGhn7nJMHk n9MHy0hyQSGbBeAc2/jgRi/dtLBN9pAy1wvo8s4Lx632FCRnrpi61ncssxYB80iyTDko gRJQ== X-Gm-Message-State: AGRZ1gJkJpFFg0DYv8M6gP5fVwiTHkxYqQ1IecsbIjf0N+zYL0QhF7qD Y6x2+p4YlvfJSLPHrGPntRD0l10Qog0= X-Received: by 2002:a63:d70e:: with SMTP id d14mr9287383pgg.159.1541185855500; Fri, 02 Nov 2018 12:10:55 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.gmail.com with ESMTPSA id q123-v6sm98718810pfq.169.2018.11.02.12.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Nov 2018 12:10:54 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Mark Salyzyn , stable@vger.kernel.org Subject: /proc/iomem: only expose physical resource addresses to privileged users Date: Fri, 2 Nov 2018 12:08:59 -0700 Message-Id: <20181102191028.226989-1-salyzyn@android.com> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds commit 51d7b120418e99d6b3bf8df9eb3cc31e8171dee4 upstream ported to 3.18.y 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. Signed-off-by: Linus Torvalds Signed-off-by: Mark Salyzyn Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org # 3.18 --- kernel/resource.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/resource.c b/kernel/resource.c index d9c7d5d77c8a..83658ca0e69c 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -104,16 +104,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; } -- 2.19.1.930.g4563a0d9d0-goog