From: Ingo Molnar <mingo@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Craig Bergstrom <craigb@google.com>,
Sander Eikelenboom <linux@eikelenboom.it>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Fengguang Wu <fengguang.wu@intel.com>,
wfg@linux.intel.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
LKP <lkp@01.org>
Subject: Re: ce56a86e2a ("x86/mm: Limit mmap() of /dev/mem to valid physical addresses"): kernel BUG at arch/x86/mm/physaddr.c:79!
Date: Fri, 27 Oct 2017 10:25:36 +0200 [thread overview]
Message-ID: <20171027082536.nddlpodniv6saylz@gmail.com> (raw)
In-Reply-To: <CA+55aFw_7PFDnTRO1C6gH99vdY+w77Rp_8Ns8krSjxmxSs6mVw@mail.gmail.com>
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Thu, Oct 26, 2017 at 9:02 PM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > Well, 'mem=2048M' shouldn't really limit device memory, it's supposed to limit
> > (trim) 'RAM' and not much else.
>
> Agreed. You should very much be able to map in IO memory or whatever
> above the 2G address even if the high_memory itself might be limited
> to 2GB.
>
> So I think that commit ce56a86e2ade ("x86/mm: Limit mmap() of /dev/mem
> to valid physical addresses") is wrong, in that "high_memory" is very
> much the wrong thing to test.
>
> The memory mapping limit might validly be something like
>
> 1ull << boot_cpu_data.x86_phys_bits
>
> or similar, but for now I suspect that the right thing to do is to
> revert. I'm not convinced that our "x86_phys_bits" value is guaranteed
> to be always right, since I think we mainlyjust use it for showing
> things, rather than have lots of code that depends on it.
>
> Ingo?
Yeah, I think a more robust condition would be something like:
int valid_phys_addr_range(phys_addr_t addr, size_t count)
{
return !((addr + count) >> MAX_PHYSMEM_BITS);
}
... as we already rely on MAX_PHYSMEM_BITS in a number of other critical places.
(Totally untested though.)
Thanks,
Ingo
next prev parent reply other threads:[~2017-10-27 8:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 2:44 ce56a86e2a ("x86/mm: Limit mmap() of /dev/mem to valid physical addresses"): kernel BUG at arch/x86/mm/physaddr.c:79! Fengguang Wu
2017-10-25 20:50 ` Boris Ostrovsky
[not found] ` <CAOJUGyfTM2J-P29yPhUx2A2SDjA0rv972SE0hmbMHonthMd_bQ@mail.gmail.com>
2017-10-26 8:05 ` Sander Eikelenboom
2017-10-26 8:12 ` Sander Eikelenboom
2017-10-26 8:58 ` Sander Eikelenboom
2017-10-26 16:35 ` Craig Bergstrom
2017-10-26 16:39 ` Ingo Molnar
2017-10-26 17:49 ` Craig Bergstrom
2017-10-26 19:02 ` Ingo Molnar
2017-10-26 19:29 ` Linus Torvalds
2017-10-26 19:50 ` Craig Bergstrom
2017-10-26 21:12 ` Linus Torvalds
2017-11-16 15:49 ` [tip:x86/urgent] x86/mm: Limit mmap() of /dev/mem to valid physical addresses tip-bot for Craig Bergstrom
2017-10-27 19:24 ` ce56a86e2a ("x86/mm: Limit mmap() of /dev/mem to valid physical addresses"): kernel BUG at arch/x86/mm/physaddr.c:79! Ingo Molnar
2017-10-27 19:28 ` Craig Bergstrom
2017-11-03 19:54 ` Craig Bergstrom
2017-10-27 8:25 ` Ingo Molnar [this message]
2017-10-26 19:29 ` Sander Eikelenboom
2017-10-26 20:01 ` [Xen-devel] " Andrew Cooper
2017-10-27 7:07 ` Jan Beulich
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=20171027082536.nddlpodniv6saylz@gmail.com \
--to=mingo@kernel.org \
--cc=boris.ostrovsky@oracle.com \
--cc=craigb@google.com \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@eikelenboom.it \
--cc=lkp@01.org \
--cc=torvalds@linux-foundation.org \
--cc=wfg@linux.intel.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;
as well as URLs for NNTP newsgroup(s).