Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634273

Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
Date 2017-05-02 11:20 +0200
Message-ID <tCC8q-4Fn-15@gated-at.bofh.it> (permalink)
References <tCB2F-3YK-17@gated-at.bofh.it> <tCBFo-4eG-7@gated-at.bofh.it> <tCBP4-4jy-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue 02-05-17 16:52:00, Xishi Qiu wrote:
> On 2017/5/2 16:43, Michal Hocko wrote:
> 
> > On Tue 02-05-17 15:59:23, Xishi Qiu wrote:
> >> Hi, I use "memtester -p 0x6c80000000000 10G" to test physical address 0x6c80000000000
> >> Because this physical address is invalid, and valid_mmap_phys_addr_range()
> >> always return 1, so it causes crash.
> >>
> >> My question is that should the user assure the physical address is valid?
> > 
> > We already seem to be checking range_is_allowed(). What is your
> > CONFIG_STRICT_DEVMEM setting? The code seems to be rather confusing but
> > my assumption is that you better know what you are doing when mapping
> > this file.
> > 
> 
> HI Michal,
> 
> CONFIG_STRICT_DEVMEM=y, and range_is_allowed() will skip memory, but
> 0x6c80000000000 is not memory, it is just a invalid address, so it cause
> crash. 

OK, I only now looked at the value. It is beyond addressable limit
(for 47b address space). None of the checks seems to stop this because
range_is_allowed() resp. its devmem_is_allowed() will allow it as a
non RAM (!page_is_ram check). I am not really sure how to fix this or
whether even we should try to fix this particular problem. As I've said
/dev/mem is dangerous and you should better know what you are doing when
accessing it.

-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Xishi Qiu <qiuxishi@huawei.com> - 2017-05-02 10:10 +0200
  Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Michal Hocko <mhocko@kernel.org> - 2017-05-02 10:50 +0200
    Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Xishi Qiu <qiuxishi@huawei.com> - 2017-05-02 11:00 +0200
      Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Michal Hocko <mhocko@kernel.org> - 2017-05-02 11:20 +0200
        Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Xishi Qiu <qiuxishi@huawei.com> - 2017-05-02 11:40 +0200

csiph-web