linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ucount: Make sure ucounts in /proc/sys/user don't regress again
@ 2020-04-07 15:46 Jan Kara
  2020-04-07 16:06 ` Andrei Vagin
  2020-04-07 19:54 ` [tip: timers/urgent] " tip-bot2 for Jan Kara
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kara @ 2020-04-07 15:46 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Andrei Vagin, Jan Kara

Commit 769071ac9f20 "ns: Introduce Time Namespace" broke reporting of
inotify ucounts (max_inotify_instances, max_inotify_watches) in
/proc/sys/user because it has added UCOUNT_TIME_NAMESPACES into enum
ucount_type but didn't properly update reporting in
kernel/ucount.c:setup_userns_sysctls(). This problem got fixed in commit
eeec26d5da82 "time/namespace: Add max_time_namespaces ucount". Add
BUILD_BUG_ON to catch a similar problem in the future.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 kernel/ucount.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/ucount.c b/kernel/ucount.c
index a53cc2b4179c..3da4d868e452 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -81,6 +81,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
 {
 #ifdef CONFIG_SYSCTL
 	struct ctl_table *tbl;
+
+	BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
 	setup_sysctl_set(&ns->set, &set_root, set_is_seen);
 	tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
 	if (tbl) {
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ucount: Make sure ucounts in /proc/sys/user don't regress again
  2020-04-07 15:46 [PATCH] ucount: Make sure ucounts in /proc/sys/user don't regress again Jan Kara
@ 2020-04-07 16:06 ` Andrei Vagin
  2020-04-07 19:54 ` [tip: timers/urgent] " tip-bot2 for Jan Kara
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Vagin @ 2020-04-07 16:06 UTC (permalink / raw)
  To: Jan Kara; +Cc: Thomas Gleixner, LKML

On Tue, Apr 7, 2020 at 8:46 AM Jan Kara <jack@suse.cz> wrote:
>
> Commit 769071ac9f20 "ns: Introduce Time Namespace" broke reporting of
> inotify ucounts (max_inotify_instances, max_inotify_watches) in
> /proc/sys/user because it has added UCOUNT_TIME_NAMESPACES into enum
> ucount_type but didn't properly update reporting in
> kernel/ucount.c:setup_userns_sysctls(). This problem got fixed in commit
> eeec26d5da82 "time/namespace: Add max_time_namespaces ucount". Add
> BUILD_BUG_ON to catch a similar problem in the future.
>

Acked-by: Andrei Vagin <avagin@gmail.com>

> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  kernel/ucount.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/kernel/ucount.c b/kernel/ucount.c
> index a53cc2b4179c..3da4d868e452 100644
> --- a/kernel/ucount.c
> +++ b/kernel/ucount.c
> @@ -81,6 +81,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
>  {
>  #ifdef CONFIG_SYSCTL
>         struct ctl_table *tbl;
> +
> +       BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
>         setup_sysctl_set(&ns->set, &set_root, set_is_seen);
>         tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
>         if (tbl) {
> --
> 2.16.4
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: timers/urgent] ucount: Make sure ucounts in /proc/sys/user don't regress again
  2020-04-07 15:46 [PATCH] ucount: Make sure ucounts in /proc/sys/user don't regress again Jan Kara
  2020-04-07 16:06 ` Andrei Vagin
@ 2020-04-07 19:54 ` tip-bot2 for Jan Kara
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Jan Kara @ 2020-04-07 19:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Jan Kara, Thomas Gleixner, Andrei Vagin, x86, LKML

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     0f538e3e712a517bd351607de50cd298102c7c08
Gitweb:        https://git.kernel.org/tip/0f538e3e712a517bd351607de50cd298102c7c08
Author:        Jan Kara <jack@suse.cz>
AuthorDate:    Tue, 07 Apr 2020 17:46:43 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 07 Apr 2020 21:51:27 +02:00

ucount: Make sure ucounts in /proc/sys/user don't regress again

Commit 769071ac9f20 "ns: Introduce Time Namespace" broke reporting of
inotify ucounts (max_inotify_instances, max_inotify_watches) in
/proc/sys/user because it has added UCOUNT_TIME_NAMESPACES into enum
ucount_type but didn't properly update reporting in
kernel/ucount.c:setup_userns_sysctls(). This problem got fixed in commit
eeec26d5da82 "time/namespace: Add max_time_namespaces ucount".

Add BUILD_BUG_ON to catch a similar problem in the future.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andrei Vagin <avagin@gmail.com>
Link: https://lkml.kernel.org/r/20200407154643.10102-1-jack@suse.cz

---
 kernel/ucount.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/ucount.c b/kernel/ucount.c
index 29c60eb..11b1596 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -82,6 +82,8 @@ bool setup_userns_sysctls(struct user_namespace *ns)
 {
 #ifdef CONFIG_SYSCTL
 	struct ctl_table *tbl;
+
+	BUILD_BUG_ON(ARRAY_SIZE(user_table) != UCOUNT_COUNTS + 1);
 	setup_sysctl_set(&ns->set, &set_root, set_is_seen);
 	tbl = kmemdup(user_table, sizeof(user_table), GFP_KERNEL);
 	if (tbl) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-07 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 15:46 [PATCH] ucount: Make sure ucounts in /proc/sys/user don't regress again Jan Kara
2020-04-07 16:06 ` Andrei Vagin
2020-04-07 19:54 ` [tip: timers/urgent] " tip-bot2 for Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).