All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Uladzislau Rezki <urezki@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, Zorro Lang <zlang@redhat.com>,
	linux-xfs@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH 1/3] usercopy: Handle vm_map_ram() areas
Date: Mon, 13 Jun 2022 10:04:55 -0700	[thread overview]
Message-ID: <202206131004.CF19D5659@keescook> (raw)
In-Reply-To: <Yqdtkhi+AAejtekZ@pc638.lan>

On Mon, Jun 13, 2022 at 07:02:10PM +0200, Uladzislau Rezki wrote:
> On Mon, Jun 13, 2022 at 05:44:35PM +0100, Matthew Wilcox wrote:
> > On Mon, Jun 13, 2022 at 09:23:15AM -0700, Kees Cook wrote:
> > > On Sun, Jun 12, 2022 at 10:32:25PM +0100, Matthew Wilcox (Oracle) wrote:
> > > > vmalloc does not allocate a vm_struct for vm_map_ram() areas.  That causes
> > > > us to deny usercopies from those areas.  This affects XFS which uses
> > > > vm_map_ram() for its directories.
> > > > 
> > > > Fix this by calling find_vmap_area() instead of find_vm_area().
> > > 
> > > Thanks for the fixes!
> > > 
> > > > [...]
> > > > +		/* XXX: We should also abort for free vmap_areas */
> > > 
> > > What's needed to detect this?
> > 
> > I'm not entirely sure.  I only just learned of the existence of this
> > struct ;-)
> > 
> >         /*
> >          * The following two variables can be packed, because
> >          * a vmap_area object can be either:
> >          *    1) in "free" tree (root is free_vmap_area_root)
> >          *    2) or "busy" tree (root is vmap_area_root)
> >          */
> >         union {
> >                 unsigned long subtree_max_size; /* in "free" tree */
> >                 struct vm_struct *vm;           /* in "busy" tree */
> >         };
> > 
> > Hmm.  Actually, we only search vmap_area_root, so I suppose it can't
> > be a free area.  So this XXX can be removed, as we'll get NULL back
> > if we've got a pointer to a free area.  Ulad, do I have this right?
> >
> Yep, we find here only allocated areas which bind to the "vmap_area_root"
> tree, so it can not be a freed area. So we will not get a pointer to the
> free area :)

Thanks!

I've tweaked the patch to drop the XXX comment.

-- 
Kees Cook

  reply	other threads:[~2022-06-13 19:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-12 21:32 [PATCH 0/3] Fixes for usercopy Matthew Wilcox (Oracle)
2022-06-12 21:32 ` [PATCH 1/3] usercopy: Handle vm_map_ram() areas Matthew Wilcox (Oracle)
2022-06-13 10:00   ` Uladzislau Rezki
2022-06-13 11:52     ` Baoquan He
2022-06-13 12:56       ` Uladzislau Rezki
2022-06-13 16:23   ` Kees Cook
2022-06-13 16:44     ` Matthew Wilcox
2022-06-13 17:02       ` Uladzislau Rezki
2022-06-13 17:04         ` Kees Cook [this message]
2022-06-12 21:32 ` [PATCH 2/3] usercopy: Cast pointer to an integer once Matthew Wilcox (Oracle)
2022-06-13  9:51   ` Uladzislau Rezki
2022-06-13 16:20     ` Kees Cook
2022-06-13 16:27       ` Uladzislau Rezki
2022-06-12 21:32 ` [PATCH 3/3] usercopy: Make usercopy resilient against ridiculously large copies Matthew Wilcox (Oracle)
2022-06-13  9:57   ` Uladzislau Rezki
2022-06-13  8:04 ` [PATCH 0/3] Fixes for usercopy Zorro Lang
2022-06-13 16:25 ` Kees Cook

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=202206131004.CF19D5659@keescook \
    --to=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=urezki@gmail.com \
    --cc=willy@infradead.org \
    --cc=zlang@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.