linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: "Gregory Price" <gourry.memverge@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Gregory Price" <gregory.price@memverge.com>
Subject: Re: [PATCH] mm/migrate: fix do_pages_move for compat pointers
Date: Tue, 03 Oct 2023 19:36:27 +0200	[thread overview]
Message-ID: <b977b720-f9e7-482f-af09-f9c94c0491ec@app.fastmail.com> (raw)
In-Reply-To: <20231003101717.f57af0208431dba6dac0357e@linux-foundation.org>

On Tue, Oct 3, 2023, at 19:17, Andrew Morton wrote:
> On Tue, 03 Oct 2023 19:01:45 +0200 "Arnd Bergmann" <arnd@arndb.de> wrote:
>> On Tue, Oct 3, 2023, at 18:57, Arnd Bergmann wrote:
>> > On Tue, Oct 3, 2023, at 18:49, Andrew Morton wrote:
>> >> On Tue,  3 Oct 2023 10:48:56 -0400 Gregory Price 
>> >> <gourry.memverge@gmail.com> wrote:
>> >>
>> >>> do_pages_move does not handle compat pointers for the page list.
>> >>> correctly.  Add in_compat_syscall check and appropriate get_user
>> >>> fetch when iterating the page list.
>> >>
>> >> What are the userspace visible effects of this change?
>> >
>> > It makes the syscall in compat mode (32-bit userspace, 64-bit kernel)
>> > work the same way as the native 32-bit syscall again, restoring the
>> > behavior before my broken commit 5b1b561ba73c ("mm: simplify
>> > compat_sys_move_pages").
>> 
>> More specifically, my patch moved the parsing of the 'pages'
>> array from the main entry point into do_pages_stat(), which left
>> the syscall working correctly for the 'stat' operation (nodes = NULL),
>> while the 'move' operation (nodes != NULL) is now missing
>> the conversion and interprets 'pages' as an array of 64-bit
>> pointers instead of the intended 32-bit userspace pointers.
>> 
>
> Thanks.  So is a cc:stable warranted?

Yes, absolutely. It is possible that nobody noticed this
bug because the few applications that actually call move_pages are
unlikely to run in compat mode because of their large memory
requirements, but this clearly fixes a user-visible regression
and should have been caught by ltp.

      Arnd


      reply	other threads:[~2023-10-03 17:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 14:48 Gregory Price
2023-10-03 14:48 ` [PATCH 2/2] mm/migrate: remove unused mm argument from do_move_pages_to_node Gregory Price
2023-10-03 16:49 ` [PATCH] mm/migrate: fix do_pages_move for compat pointers Andrew Morton
2023-10-03 16:57   ` Arnd Bergmann
2023-10-03 17:01     ` Arnd Bergmann
2023-10-03 17:17       ` Andrew Morton
2023-10-03 17:36         ` Arnd Bergmann [this message]

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=b977b720-f9e7-482f-af09-f9c94c0491ec@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=gourry.memverge@gmail.com \
    --cc=gregory.price@memverge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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