2019-10-23 10:32:16

by Michal Hocko

[permalink] [raw]
Subject: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

From: Michal Hocko <[email protected]>

/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.

Reported-by: Waiman Long <[email protected]>
Cc: stable
Signed-off-by: Michal Hocko <[email protected]>
---
mm/vmstat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 6afc892a148a..4e885ecd44d1 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1972,7 +1972,7 @@ void __init init_mm_internals(void)
#endif
#ifdef CONFIG_PROC_FS
proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
- proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
+ proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
#endif
--
2.20.1


2019-10-23 20:05:42

by Mel Gorman

[permalink] [raw]
Subject: Re: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

On Wed, Oct 23, 2019 at 12:27:36PM +0200, Michal Hocko wrote:
> From: Michal Hocko <[email protected]>
>
> /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.
>
> Reported-by: Waiman Long <[email protected]>
> Cc: stable
> Signed-off-by: Michal Hocko <[email protected]>

Acked-by: Mel Gorman <[email protected]>

--
Mel Gorman
SUSE Labs

2019-10-23 21:31:31

by Vlastimil Babka

[permalink] [raw]
Subject: Re: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

On 10/23/19 12:27 PM, Michal Hocko wrote:
> From: Michal Hocko <[email protected]>
>
> /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.
>
> Reported-by: Waiman Long <[email protected]>
> Cc: stable
> Signed-off-by: Michal Hocko <[email protected]>

Acked-by: Vlastimil Babka <[email protected]>

> ---
> mm/vmstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 6afc892a148a..4e885ecd44d1 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1972,7 +1972,7 @@ void __init init_mm_internals(void)
> #endif
> #ifdef CONFIG_PROC_FS
> proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
> - proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
> + proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
> proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
> proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
> #endif
>

2019-10-24 01:23:56

by Waiman Long

[permalink] [raw]
Subject: Re: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

On 10/23/19 6:27 AM, Michal Hocko wrote:
> From: Michal Hocko <[email protected]>
>
> /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.
>
> Reported-by: Waiman Long <[email protected]>
> Cc: stable
> Signed-off-by: Michal Hocko <[email protected]>
> ---
> mm/vmstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 6afc892a148a..4e885ecd44d1 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1972,7 +1972,7 @@ void __init init_mm_internals(void)
> #endif
> #ifdef CONFIG_PROC_FS
> proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
> - proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
> + proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
> proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
> proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
> #endif

Acked-by: Waiman Long <[email protected]>

2019-10-24 02:35:55

by Rafael Aquini

[permalink] [raw]
Subject: Re: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

On Wed, Oct 23, 2019 at 12:27:36PM +0200, Michal Hocko wrote:
> From: Michal Hocko <[email protected]>
>
> /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.
>
> Reported-by: Waiman Long <[email protected]>
> Cc: stable
> Signed-off-by: Michal Hocko <[email protected]>
> ---
> mm/vmstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 6afc892a148a..4e885ecd44d1 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1972,7 +1972,7 @@ void __init init_mm_internals(void)
> #endif
> #ifdef CONFIG_PROC_FS
> proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
> - proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
> + proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
> proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
> proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
> #endif
> --
> 2.20.1
>

Acked-by: Rafael Aquini <[email protected]>

2019-10-24 05:47:28

by Vlastimil Babka

[permalink] [raw]
Subject: Re: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

+ linux-api

On 10/23/19 12:27 PM, Michal Hocko wrote:
> From: Michal Hocko <[email protected]>
>
> /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.
>
> Reported-by: Waiman Long <[email protected]>
> Cc: stable
> Signed-off-by: Michal Hocko <[email protected]>
> ---
> mm/vmstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 6afc892a148a..4e885ecd44d1 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1972,7 +1972,7 @@ void __init init_mm_internals(void)
> #endif
> #ifdef CONFIG_PROC_FS
> proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op);
> - proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op);
> + proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op);
> proc_create_seq("vmstat", 0444, NULL, &vmstat_op);
> proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op);
> #endif
>

2019-10-25 18:56:23

by David Rientjes

[permalink] [raw]
Subject: Re: [RFC PATCH 1/2] mm, vmstat: hide /proc/pagetypeinfo from normal users

On Wed, 23 Oct 2019, Michal Hocko wrote:

> From: Michal Hocko <[email protected]>
>
> /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.
>
> Reported-by: Waiman Long <[email protected]>
> Cc: stable
> Signed-off-by: Michal Hocko <[email protected]>

Acked-by: David Rientjes <[email protected]>