From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D5EC43331 for ; Mon, 11 Nov 2019 19:10:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 163F5204EC for ; Mon, 11 Nov 2019 19:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573499441; bh=hRjSS52Bk2f/86Mm6L764w/hdN31rB/1Bp8maYVfs+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qwMXxvsFU4vgtHDfG3Njtj9QZAyIk8Qe1wJkZgbhh20Ga4MMTmoNq8blguu+h562G ODoSrtWp2NNEN0wz+erYAI04Yf5RrexMge4+mgOXKfzliSBoa5VyvL3q2N8IB+jOCK Zzks9Pv4IQAUkd8MikhXQYS38gpufdME5YJ9oGnM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727517AbfKKSbt (ORCPT ); Mon, 11 Nov 2019 13:31:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:48510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727503AbfKKSbt (ORCPT ); Mon, 11 Nov 2019 13:31:49 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 80FEE20656; Mon, 11 Nov 2019 18:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573497108; bh=hRjSS52Bk2f/86Mm6L764w/hdN31rB/1Bp8maYVfs+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEYXSb3+G/zCEl74tJvG8v5y3Qvc+J4242Q1Q+BTBuQf5HJdjs7PxBtSHKw6hoq95 dJNVL5NsMjS9Nuuh/wWXh6lW0Y7XVMqyQl/jqoNd20XjRC87Rsi3N1OP+gV7Kv+iDM EeSnbxmHAoaSZSW3U4fBo1nAC16DA39ROVxLpw4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Hocko , Waiman Long , Mel Gorman , Vlastimil Babka , Rafael Aquini , David Rientjes , Andrew Morton , David Hildenbrand , Johannes Weiner , Roman Gushchin , Konstantin Khlebnikov , Jann Horn , Song Liu , Linus Torvalds Subject: [PATCH 4.4 10/43] mm, vmstat: hide /proc/pagetypeinfo from normal users Date: Mon, 11 Nov 2019 19:28:24 +0100 Message-Id: <20191111181259.133933103@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191111181246.772983347@linuxfoundation.org> References: <20191111181246.772983347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Michal Hocko commit abaed0112c1db08be15a784a2c5c8a8b3063cdd3 upstream. /proc/pagetypeinfo is a debugging tool to examine internal page allocator state wrt to fragmentation. It is not very useful for any other use so normal users really do not need to read this file. Waiman Long has noticed that reading this file can have negative side effects because zone->lock is necessary for gathering data and that a) interferes with the page allocator and its users and b) can lead to hard lockups on large machines which have very long free_list. Reduce both issues by simply not exporting the file to regular users. Link: http://lkml.kernel.org/r/20191025072610.18526-2-mhocko@kernel.org Fixes: 467c996c1e19 ("Print out statistics in relation to fragmentation avoidance to /proc/pagetypeinfo") Signed-off-by: Michal Hocko Reported-by: Waiman Long Acked-by: Mel Gorman Acked-by: Vlastimil Babka Acked-by: Waiman Long Acked-by: Rafael Aquini Acked-by: David Rientjes Reviewed-by: Andrew Morton Cc: David Hildenbrand Cc: Johannes Weiner Cc: Roman Gushchin Cc: Konstantin Khlebnikov Cc: Jann Horn Cc: Song Liu Cc: Greg Kroah-Hartman Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/vmstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1589,7 +1589,7 @@ static int __init setup_vmstat(void) #endif #ifdef CONFIG_PROC_FS proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations); - proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops); + proc_create("pagetypeinfo", 0400, NULL, &pagetypeinfo_file_ops); proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations); proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations); #endif