From: Oleg Nesterov <oleg@redhat.com>
To: Bill Wendling <morbo@google.com>
Cc: "Christian Brauner" <brauner@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"Bradley Morgan" <brads@mainlining.org>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Kees Cook" <kees@kernel.org>, "Aleksa Sarai" <cyphar@cyphar.com>,
"Jan Kara" <jack@suse.cz>,
"Nathan Chancellor" <nathan@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Thomas Gleixner" <tglx@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Alice Ryhl" <aliceryhl@google.com>,
"Douglas Anderson" <dianders@chromium.org>,
"Anand Moon" <linux.amoon@gmail.com>,
codemender-patching+linux@google.com,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v5 1/2] userns: Add __counted_by_ptr attribute to struct uid_gid_map
Date: Wed, 9 Sep 2026 01:01:15 +0200 [thread overview]
Message-ID: <aqCTfVdDOy5ZOx6c@redhat.com> (raw)
In-Reply-To: <20260908222734.3048684-1-morbo@google.com>
On 09/08, Bill Wendling wrote:
>
> We can add the __counted_by_ptr attribute to the 'forward' and 'reverse'
> pointer fields of 'struct uid_gid_map', which are counted by
> 'nr_extents'.
Since I am CC'ed again... (thanks btw)
Personally, I am not a huge fan of __counted_by_ptr, at least in this
particular case. But 1/2 looks technically correct, I think it doesn't
hurt ;)
So, FWIW
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
> --- a/kernel/user_namespace.c
> +++ b/kernel/user_namespace.c
> @@ -809,13 +809,17 @@ static int insert_extent(struct uid_gid_map *map, struct uid_gid_extent *extent)
> map->reverse = NULL;
> }
>
> - if (map->nr_extents < UID_GID_MAP_MAX_BASE_EXTENTS)
> - dest = &map->extent[map->nr_extents];
> + /*
> + * nr_extents must be updated before the extent and forward arrays are
> + * accessed, otherwise KSAN will assert an out-of-bounds error.
> + */
> + map->nr_extents++;
Yes, but perhaps the comment should be more explicit...
I mean, something like
... otherwise KSAN ... because of __counted_by_ptr(nr_extents)
Nevermind, this is just a minor/subjective nit.
Oleg.
next prev parent reply other threads:[~2026-09-08 23:01 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-23 12:51 [PATCH 0/2] " Bill Wendling
2026-08-23 12:51 ` [PATCH 1/2] userns: " Bill Wendling
2026-08-23 13:50 ` Bradley Morgan
2026-08-23 14:52 ` Oleg Nesterov
2026-08-26 22:05 ` Bill Wendling
2026-08-24 19:18 ` Gustavo A. R. Silva
2026-08-23 12:51 ` [PATCH 2/2] userns: Add KUnit test suite for uid_gid_map Bill Wendling
2026-08-23 12:53 ` Bill Wendling
2026-08-26 20:43 ` [PATCH v3 " Bill Wendling
2026-08-26 21:21 ` Bradley Morgan
2026-08-26 22:04 ` Bill Wendling
2026-08-23 13:48 ` [PATCH " Bradley Morgan
2026-08-26 20:37 ` Bill Wendling
2026-08-24 6:13 ` Thomas Weißschuh
2026-08-26 20:40 ` Bill Wendling
2026-08-27 13:25 ` Thomas Weißschuh
2026-09-08 22:27 ` [PATCH v5 1/2] userns: Add __counted_by_ptr attribute to struct uid_gid_map Bill Wendling
2026-09-08 22:27 ` [PATCH v5 2/2] userns: Add KUnit test suite for uid_gid_map Bill Wendling
2026-09-09 15:36 ` Bradley Morgan
2026-09-09 19:54 ` Bill Wendling
2026-09-08 23:01 ` Oleg Nesterov [this message]
2026-09-09 7:46 ` [PATCH v5 1/2] userns: Add __counted_by_ptr attribute to struct uid_gid_map Christian Brauner
2026-08-26 22:00 ` [PATCH v4 " Bill Wendling
2026-08-26 22:00 ` [PATCH v4 2/2] userns: Add KUnit test suite for uid_gid_map Bill Wendling
2026-08-26 22:27 ` Bradley Morgan
2026-08-27 13:36 ` Thomas Weißschuh
2026-08-27 19:27 ` Bill Wendling
2026-08-31 9:22 ` Thomas Weißschuh
2026-09-03 20:21 ` Bill Wendling
2026-09-04 8:02 ` Thomas Weißschuh
2026-09-04 20:37 ` Bill Wendling
2026-09-04 23:34 ` Kees Cook
2026-09-08 17:44 ` Bill Wendling
2026-09-04 23:41 ` Kees Cook
2026-09-08 17:46 ` Bill Wendling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqCTfVdDOy5ZOx6c@redhat.com \
--to=oleg@redhat.com \
--cc=aliceryhl@google.com \
--cc=brads@mainlining.org \
--cc=brauner@kernel.org \
--cc=codemender-patching+linux@google.com \
--cc=cyphar@cyphar.com \
--cc=dianders@chromium.org \
--cc=gary@garyguo.net \
--cc=gustavoars@kernel.org \
--cc=jack@suse.cz \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.amoon@gmail.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=tglx@kernel.org \
--cc=thomas.weissschuh@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®