Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp17837imu; Thu, 8 Nov 2018 14:00:59 -0800 (PST) X-Google-Smtp-Source: AJdET5dsdj7HAyxVGWONPxPZLti1FiSdFE/oALck1bWQL1ZftDnIsBgViB5xCOESR28xg8IpovnE X-Received: by 2002:a62:1c1:: with SMTP id 184-v6mr6324906pfb.242.1541714459347; Thu, 08 Nov 2018 14:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541714459; cv=none; d=google.com; s=arc-20160816; b=x78Tb/bcLs4qincZoN5jmYRPhTA76bC5o2f18q8OHxfLN9uhiM8RW9NMVly0KweIwJ 0ftmnSIHwPCTm4ManrfSeNGjvaQ7Z9QjLKN7C9BSxQ/BOXywVn1+HOvX71hzXLiLWalc gaBX44xQE6/E7+HIQxiQyWMM49ZuubxEL7NEdwEBnc90yFmdvobTkfaf/nYzQrbfCTC+ bJ1Bq0txLX+YSzPf2dRycnKvrIKM0a0DbYOAEpQEipjGNhnPDOFUiBymtURaEFsxhgPz 5/kMJEnxgKXnB6ZTB3/Mo9Of0q0B1e5YphcMtvY/DopGLj37ddEN9nE1CUgzw1ycofJ8 0lqw== 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:subject:cc:to :from:dkim-signature; bh=6aGi/ZtRlSoAQs0QC7n/ygoc1Dnk8N7cBH5LXe3fD4c=; b=hr4eQJ9l3ppl8yUMtZmOEemq/Pmqytstp7d5BJoWevKjErR9Kswr6j4fmQCZxPZojc PqvRKH5525PXQ6jpn72iW0Phe1gd/NZdAfvGkH7c28pyNo5GvkOdCf66hCfImle+hEpE TQjfdWv9cKEsJn0wp3sqABtZIf/moTjUg9aLQ1eVxz3wX1lA2BYivXnhaSHfRH3BH9Lz fd9q6LgrO+Y7VvwGTM+u1sbejUjP9PETGwIPPeH+nNwBTjvafVCV3cXD90UWrx1dnBHu 3yDCqNXwyQDqap2Y6TXslODrJdp+p8AFfkxoRTUwO+BnqoJNo/exN9aBnPgi32cmZIiS vw5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SDMsNyPA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si5433425plx.83.2018.11.08.14.00.44; Thu, 08 Nov 2018 14:00:59 -0800 (PST) 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=@kernel.org header.s=default header.b=SDMsNyPA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729686AbeKIHft (ORCPT + 99 others); Fri, 9 Nov 2018 02:35:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:52724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728279AbeKIHfm (ORCPT ); Fri, 9 Nov 2018 02:35:42 -0500 Received: from localhost (unknown [208.72.13.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A00AB21019; Thu, 8 Nov 2018 21:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714294; bh=Jg/4NBMu7SJ95kBOi4gtxCvwKNez21QjGDz9XT834UA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDMsNyPACGLQBOo7updBW8nUuMVFq1Ytd0j1DXCTIY98avIhXHEbFiEJ2ZojkDXsr HHBs9FzzCzwLlAD889zJWNSCB1RJhzD78rq9OL+R9qivqTJ0WBmBmYhMhcezDV9gKH +hTAEO5WzSkA2frgszwJ+VcMIHNXXTufPtgVOtdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Mark Salyzyn Subject: [PATCH 3.18 129/144] /proc/iomem: only expose physical resource addresses to privileged users Date: Thu, 8 Nov 2018 13:51:40 -0800 Message-Id: <20181108215107.454226384@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215054.826084593@linuxfoundation.org> References: <20181108215054.826084593@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Torvalds commit 51d7b120418e99d6b3bf8df9eb3cc31e8171dee4 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. Signed-off-by: Linus Torvalds Signed-off-by: Mark Salyzyn Signed-off-by: Greg Kroah-Hartman --- kernel/resource.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/kernel/resource.c +++ b/kernel/resource.c @@ -104,16 +104,25 @@ static int r_show(struct seq_file *m, vo { 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; }