public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Li Wang <liwang@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	heiko.carstens@de.ibm.com, mingo@kernel.org, hughd@google.com,
	paul.gortmaker@windriver.com, mhocko@suse.com,
	Shu Wang <shuwang@redhat.com>
Subject: Re: [PATCH] s390/mm: return -ENOMEM in arch_get_unmapped_area[_topdown]
Date: Thu, 26 Oct 2017 12:16:02 +0200	[thread overview]
Message-ID: <20171026121602.295e7a6e@mschwideX1> (raw)
In-Reply-To: <CAEemH2dtDCe1SPRTfHAmh8s75mek1jh7MwTiiTfWMq1N2AA89Q@mail.gmail.com>

On Thu, 26 Oct 2017 17:47:39 +0800
Li Wang <liwang@redhat.com> wrote:

> On Thu, Oct 26, 2017 at 5:26 PM, Martin Schwidefsky
> <schwidefsky@de.ibm.com> wrote:
> > On Thu, 26 Oct 2017 15:36:10 +0800
> > Li Wang <liwang@redhat.com> wrote:
> >  
> > The code in mmap.c checks for the per-task limit, 31-bit vs 64-bit.
> > pgalloc.c checks for the maximum allowed address and does not care
> > about the task.
> >  
> >> Fixes: 8ab867cb0806 (s390/mm: fix BUG_ON in crst_table_upgrade)
> >> Signed-off-by: Li Wang <liwang@redhat.com>  
> >
> > I don't think this patch fixes anything.  
> 
> At least there is a logic error i think, after apply the patch
> "s390/mm: fix BUG_ON in crst_table_upgrade",
> it makes no sense to compare "if (end >= TASK_SIZE_MAX) return
> -ENOMEM" in crst_table_upgrade() function.
> 
> isn't it?

Be careful with TASK_SIZE vs. TASK_SIZE_MAX. They return different
values for 31-bit compat tasks.

If the addr parameter is correctly aligned then the if condition in
crst_table_upgrade is superfluous as TASK_SIZE_MAX is now -PAGE_SIZE
with the introduction of 5 level page tables. It is important for older
kernels with only 4 level page tables with a TASK_SIZE_MAX of 2**53.

On the other hand if addr is ever a value between -PAGE_SIZE and -1
we would end up with an endless loop. That makes the if condition a
safe-guard and I would like to keep it.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

  reply	other threads:[~2017-10-26 10:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26  7:36 [PATCH] s390/mm: return -ENOMEM in arch_get_unmapped_area[_topdown] Li Wang
2017-10-26  9:26 ` Martin Schwidefsky
2017-10-26  9:47   ` Li Wang
2017-10-26 10:16     ` Martin Schwidefsky [this message]
2017-11-09  4:36       ` Li Wang

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=20171026121602.295e7a6e@mschwideX1 \
    --to=schwidefsky@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=liwang@redhat.com \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=shuwang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox