2023-09-21 20:58:46

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 0/2] maple_tree: Fix mas_prev() state regression.

On Thu, 21 Sep 2023 14:12:34 -0400 "Liam R. Howlett" <[email protected]> wrote:

> Pedro Falcato contacted me on IRC with an mprotect regression which was
> bisected back to the iterator changes for maple tree. Root cause
> analysis showed the mas_prev() running off the end of the VMA space
> (previous from 0) followed by mas_find(), would skip the first value.
>
> This patch set introduces maple state underflow/overflow so the sequence
> of calls on the maple state will return what the user expects.

It isn't clear what are the user-visible effects of this flaw? Please
send this along and I'll paste it in.

Patch 1 should be titled "Add mas_is_active ...".

And patch 1 should have had cc:stable in the changelog.

It's [email protected], although [email protected] works just fine.


2023-09-21 21:27:25

by Liam R. Howlett

[permalink] [raw]
Subject: Re: [PATCH 0/2] maple_tree: Fix mas_prev() state regression.

* Andrew Morton <[email protected]> [230921 14:25]:
> On Thu, 21 Sep 2023 14:12:34 -0400 "Liam R. Howlett" <[email protected]> wrote:
>
> > Pedro Falcato contacted me on IRC with an mprotect regression which was
> > bisected back to the iterator changes for maple tree. Root cause
> > analysis showed the mas_prev() running off the end of the VMA space
> > (previous from 0) followed by mas_find(), would skip the first value.
> >
> > This patch set introduces maple state underflow/overflow so the sequence
> > of calls on the maple state will return what the user expects.
>
> It isn't clear what are the user-visible effects of this flaw? Please
> send this along and I'll paste it in.


User may notice that mas_prev() or mas_next() calls that result in going
outside of the limit passed to the call will cause incorrect returns on
subsequent calls using that maple state, such as mas_find() skipping an
entry.

>
> Patch 1 should be titled "Add mas_is_active ...".

Oh yes, sorry.

>
> And patch 1 should have had cc:stable in the changelog.

Ah, I sent the series to stable but didn't add that to the changelog.
I'll do that in v2 as it seems I need to update patch 2 anyways.

>
> It's [email protected], although [email protected] works just fine.

2023-09-22 08:04:39

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH 0/2] maple_tree: Fix mas_prev() state regression.

On Thu, Sep 21, 2023 at 02:53:30PM -0400, Liam R. Howlett wrote:
> * Andrew Morton <[email protected]> [230921 14:25]:
> > On Thu, 21 Sep 2023 14:12:34 -0400 "Liam R. Howlett" <[email protected]> wrote:
> >
> > > Pedro Falcato contacted me on IRC with an mprotect regression which was
> > > bisected back to the iterator changes for maple tree. Root cause
> > > analysis showed the mas_prev() running off the end of the VMA space
> > > (previous from 0) followed by mas_find(), would skip the first value.
> > >
> > > This patch set introduces maple state underflow/overflow so the sequence
> > > of calls on the maple state will return what the user expects.
> >
> > It isn't clear what are the user-visible effects of this flaw? Please
> > send this along and I'll paste it in.
>
>
> User may notice that mas_prev() or mas_next() calls that result in going
> outside of the limit passed to the call will cause incorrect returns on
> subsequent calls using that maple state, such as mas_find() skipping an
> entry.

When Andrew says "User visible" he means "userspace visible". Not
"in kernel user visible". What are the _consequences_.

I'd say that if the user maps something at address 0, mprotect() can
then fail to ... or something.