* [PATCH] ucount: Fix wrong inotify ucounts in /proc/sys/user
@ 2020-04-07 12:18 Jan Kara
2020-04-07 14:09 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2020-04-07 12:18 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Andrei Vagin, LKML, Jan Kara, stable
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(). Update the reporting to fix the
issue and also add BUILD_BUG_ON to catch a similar problem in the
future.
Fixes: 769071ac9f20 "ns: Introduce Time Namespace"
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
kernel/ucount.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/ucount.c b/kernel/ucount.c
index a53cc2b4179c..11b1596e2542 100644
--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -69,6 +69,7 @@ static struct ctl_table user_table[] = {
UCOUNT_ENTRY("max_net_namespaces"),
UCOUNT_ENTRY("max_mnt_namespaces"),
UCOUNT_ENTRY("max_cgroup_namespaces"),
+ UCOUNT_ENTRY("max_time_namespaces"),
#ifdef CONFIG_INOTIFY_USER
UCOUNT_ENTRY("max_inotify_instances"),
UCOUNT_ENTRY("max_inotify_watches"),
@@ -81,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) {
--
2.16.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ucount: Fix wrong inotify ucounts in /proc/sys/user
2020-04-07 12:18 [PATCH] ucount: Fix wrong inotify ucounts in /proc/sys/user Jan Kara
@ 2020-04-07 14:09 ` Thomas Gleixner
2020-04-07 15:39 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2020-04-07 14:09 UTC (permalink / raw)
To: Jan Kara; +Cc: Andrei Vagin, LKML, Jan Kara, stable
Jan Kara <jack@suse.cz> writes:
> 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(). Update the reporting to fix the
> issue and also add BUILD_BUG_ON to catch a similar problem in the
> future.
Just merged that:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=timers/urgent&id=eeec26d5da8248ea4e240b8795bb4364213d3247
Could you please send a patch with just the build bug on ?
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ucount: Fix wrong inotify ucounts in /proc/sys/user
2020-04-07 14:09 ` Thomas Gleixner
@ 2020-04-07 15:39 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2020-04-07 15:39 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Jan Kara, Andrei Vagin, LKML, stable
On Tue 07-04-20 16:09:39, Thomas Gleixner wrote:
> Jan Kara <jack@suse.cz> writes:
> > 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(). Update the reporting to fix the
> > issue and also add BUILD_BUG_ON to catch a similar problem in the
> > future.
>
> Just merged that:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?h=timers/urgent&id=eeec26d5da8248ea4e240b8795bb4364213d3247
>
> Could you please send a patch with just the build bug on ?
Sure, will do.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-07 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 12:18 [PATCH] ucount: Fix wrong inotify ucounts in /proc/sys/user Jan Kara
2020-04-07 14:09 ` Thomas Gleixner
2020-04-07 15:39 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®