All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
@ 2017-05-02  7:59 ` Xishi Qiu
  0 siblings, 0 replies; 10+ messages in thread
From: Xishi Qiu @ 2017-05-02  7:59 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Michal Hocko, Johannes Weiner, Rik van Riel, Shakeel Butt
  Cc: Linux MM, LKML, zhong jiang

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?

...
[ 169.147578] ? panic+0x1f1/0x239
[ 169.150789] oops_end+0xb8/0xd0
[ 169.153910] pgtable_bad+0x8a/0x95
[ 169.157294] __do_page_fault+0x3aa/0x4a0
[ 169.161194] do_page_fault+0x30/0x80
[ 169.164750] ? do_syscall_64+0x175/0x180
[ 169.168649] page_fault+0x28/0x30

Thanks,
Xishi Qiu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
@ 2017-05-02  7:59 ` Xishi Qiu
  0 siblings, 0 replies; 10+ messages in thread
From: Xishi Qiu @ 2017-05-02  7:59 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Michal Hocko, Johannes Weiner, Rik van Riel, Shakeel Butt
  Cc: Linux MM, LKML, zhong jiang

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?

...
[ 169.147578] ? panic+0x1f1/0x239
[ 169.150789] oops_end+0xb8/0xd0
[ 169.153910] pgtable_bad+0x8a/0x95
[ 169.157294] __do_page_fault+0x3aa/0x4a0
[ 169.161194] do_page_fault+0x30/0x80
[ 169.164750] ? do_syscall_64+0x175/0x180
[ 169.168649] page_fault+0x28/0x30

Thanks,
Xishi Qiu

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
  2017-05-02  7:59 ` Xishi Qiu
@ 2017-05-02  8:43   ` Michal Hocko
  -1 siblings, 0 replies; 10+ messages in thread
From: Michal Hocko @ 2017-05-02  8:43 UTC (permalink / raw)
  To: Xishi Qiu
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

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.

> ...
> [ 169.147578] ? panic+0x1f1/0x239
> [ 169.150789] oops_end+0xb8/0xd0
> [ 169.153910] pgtable_bad+0x8a/0x95
> [ 169.157294] __do_page_fault+0x3aa/0x4a0
> [ 169.161194] do_page_fault+0x30/0x80
> [ 169.164750] ? do_syscall_64+0x175/0x180
> [ 169.168649] page_fault+0x28/0x30
> 
> Thanks,
> Xishi Qiu

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
@ 2017-05-02  8:43   ` Michal Hocko
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Hocko @ 2017-05-02  8:43 UTC (permalink / raw)
  To: Xishi Qiu
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

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.

> ...
> [ 169.147578] ? panic+0x1f1/0x239
> [ 169.150789] oops_end+0xb8/0xd0
> [ 169.153910] pgtable_bad+0x8a/0x95
> [ 169.157294] __do_page_fault+0x3aa/0x4a0
> [ 169.161194] do_page_fault+0x30/0x80
> [ 169.164750] ? do_syscall_64+0x175/0x180
> [ 169.168649] page_fault+0x28/0x30
> 
> Thanks,
> Xishi Qiu

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
  2017-05-02  8:43   ` Michal Hocko
@ 2017-05-02  8:52     ` Xishi Qiu
  -1 siblings, 0 replies; 10+ messages in thread
From: Xishi Qiu @ 2017-05-02  8:52 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

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. 
You mean the user should assure the physical address is valid, right?

Thanks,
Xishi Qiu

>> ...
>> [ 169.147578] ? panic+0x1f1/0x239
>> [ 169.150789] oops_end+0xb8/0xd0
>> [ 169.153910] pgtable_bad+0x8a/0x95
>> [ 169.157294] __do_page_fault+0x3aa/0x4a0
>> [ 169.161194] do_page_fault+0x30/0x80
>> [ 169.164750] ? do_syscall_64+0x175/0x180
>> [ 169.168649] page_fault+0x28/0x30
>>
>> Thanks,
>> Xishi Qiu
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
@ 2017-05-02  8:52     ` Xishi Qiu
  0 siblings, 0 replies; 10+ messages in thread
From: Xishi Qiu @ 2017-05-02  8:52 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

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. 
You mean the user should assure the physical address is valid, right?

Thanks,
Xishi Qiu

>> ...
>> [ 169.147578] ? panic+0x1f1/0x239
>> [ 169.150789] oops_end+0xb8/0xd0
>> [ 169.153910] pgtable_bad+0x8a/0x95
>> [ 169.157294] __do_page_fault+0x3aa/0x4a0
>> [ 169.161194] do_page_fault+0x30/0x80
>> [ 169.164750] ? do_syscall_64+0x175/0x180
>> [ 169.168649] page_fault+0x28/0x30
>>
>> Thanks,
>> Xishi Qiu
> 



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
  2017-05-02  8:52     ` Xishi Qiu
@ 2017-05-02  9:16       ` Michal Hocko
  -1 siblings, 0 replies; 10+ messages in thread
From: Michal Hocko @ 2017-05-02  9:16 UTC (permalink / raw)
  To: Xishi Qiu
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
@ 2017-05-02  9:16       ` Michal Hocko
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Hocko @ 2017-05-02  9:16 UTC (permalink / raw)
  To: Xishi Qiu
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
  2017-05-02  9:16       ` Michal Hocko
@ 2017-05-02  9:30         ` Xishi Qiu
  -1 siblings, 0 replies; 10+ messages in thread
From: Xishi Qiu @ 2017-05-02  9:30 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

On 2017/5/2 17:16, Michal Hocko wrote:

> 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.
> 

OK, I know, thank you!

Thanks,
Xishi Qiu

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash
@ 2017-05-02  9:30         ` Xishi Qiu
  0 siblings, 0 replies; 10+ messages in thread
From: Xishi Qiu @ 2017-05-02  9:30 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Mel Gorman, Vlastimil Babka, Joonsoo Kim,
	Johannes Weiner, Rik van Riel, Shakeel Butt, Linux MM, LKML,
	zhong jiang

On 2017/5/2 17:16, Michal Hocko wrote:

> 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.
> 

OK, I know, thank you!

Thanks,
Xishi Qiu

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-05-02  9:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02  7:59 [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Xishi Qiu
2017-05-02  7:59 ` Xishi Qiu
2017-05-02  8:43 ` Michal Hocko
2017-05-02  8:43   ` Michal Hocko
2017-05-02  8:52   ` Xishi Qiu
2017-05-02  8:52     ` Xishi Qiu
2017-05-02  9:16     ` Michal Hocko
2017-05-02  9:16       ` Michal Hocko
2017-05-02  9:30       ` Xishi Qiu
2017-05-02  9:30         ` Xishi Qiu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.