From: Tycho Andersen <tycho@tycho.ws>
To: Laurent Vivier <laurent@vivier.eu>
Cc: linux-kernel@vger.kernel.org, Dmitry Safonov <dima@arista.com>,
linux-api@vger.kernel.org, containers@lists.linux-foundation.org,
Jann Horn <jannh@google.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Eric Biederman <ebiederm@xmission.com>,
linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [RFC v5 1/1] ns: add binfmt_misc to the user namespace
Date: Tue, 9 Oct 2018 08:16:41 -0700 [thread overview]
Message-ID: <20181009151641.GB10149@cisco> (raw)
In-Reply-To: <20181009103752.21482-2-laurent@vivier.eu>
On Tue, Oct 09, 2018 at 12:37:52PM +0200, Laurent Vivier wrote:
> @@ -80,18 +74,32 @@ static int entry_count;
> */
> #define MAX_REGISTER_LENGTH 1920
>
> +static struct binfmt_namespace *binfmt_ns(struct user_namespace *ns)
> +{
> + struct binfmt_namespace *b_ns;
> +
> + while (ns) {
> + b_ns = READ_ONCE(ns->binfmt_ns);
> + if (b_ns)
> + return b_ns;
> + ns = ns->parent;
> + }
> + WARN_ON_ONCE(1);
It looks like we warn here,
> @@ -133,17 +141,18 @@ static int load_misc_binary(struct linux_binprm *bprm)
> struct file *interp_file = NULL;
> int retval;
> int fd_binary = -1;
> + struct binfmt_namespace *ns = binfmt_ns(current_user_ns());
>
> retval = -ENOEXEC;
> - if (!enabled)
> + if (!ns->enabled)
...but then in cases like this we immediately dereference the pointer
anyways and crash. Can we return some other error code here in the !ns
case so we don't crash?
Tycho
next prev parent reply other threads:[~2018-10-09 22:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 10:37 [RFC v5 0/1] ns: introduce binfmt_misc namespace Laurent Vivier
2018-10-09 10:37 ` [RFC v5 1/1] ns: add binfmt_misc to the user namespace Laurent Vivier
2018-10-09 12:43 ` Jann Horn
2018-10-09 13:06 ` Laurent Vivier
2018-10-09 13:15 ` Jann Horn
2018-10-09 15:16 ` Tycho Andersen [this message]
2018-10-09 15:19 ` Laurent Vivier
2018-10-10 7:14 ` Aleksa Sarai
2018-10-10 10:11 ` Laurent Vivier
2018-10-09 16:15 ` Kirill Tkhai
2018-10-09 16:45 ` Laurent Vivier
2018-10-09 16:53 ` Jann Horn
2018-10-09 16:57 ` Laurent Vivier
2018-10-09 17:01 ` Jann Horn
2018-10-09 17:01 ` Kirill Tkhai
2018-10-09 17:22 ` Laurent Vivier
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=20181009151641.GB10149@cisco \
--to=tycho@tycho.ws \
--cc=James.Bottomley@HansenPartnership.com \
--cc=containers@lists.linux-foundation.org \
--cc=dima@arista.com \
--cc=ebiederm@xmission.com \
--cc=jannh@google.com \
--cc=laurent@vivier.eu \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).