From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 75AA46B02E1 for ; Tue, 2 May 2017 04:02:10 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id p9so79853326pfj.8 for ; Tue, 02 May 2017 01:02:10 -0700 (PDT) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com. [45.249.212.188]) by mx.google.com with ESMTPS id p12si6136254pli.219.2017.05.02.01.02.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 01:02:09 -0700 (PDT) Message-ID: <59083C5B.5080204@huawei.com> Date: Tue, 2 May 2017 15:59:23 +0800 From: Xishi Qiu MIME-Version: 1.0 Subject: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id 9A4616B02E1 for ; Tue, 2 May 2017 04:43:26 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id z88so13022888wrc.9 for ; Tue, 02 May 2017 01:43:26 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id a195si1858865wmd.35.2017.05.02.01.43.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 01:43:25 -0700 (PDT) Date: Tue, 2 May 2017 10:43:23 +0200 From: Michal Hocko Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Message-ID: <20170502084323.GG14593@dhcp22.suse.cz> References: <59083C5B.5080204@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59083C5B.5080204@huawei.com> Sender: owner-linux-mm@kvack.org List-ID: 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id EA74D6B02F2 for ; Tue, 2 May 2017 04:54:48 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id t7so55261272pgt.6 for ; Tue, 02 May 2017 01:54:48 -0700 (PDT) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com. [45.249.212.188]) by mx.google.com with ESMTPS id j88si16971007pfj.117.2017.05.02.01.54.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 01:54:48 -0700 (PDT) Message-ID: <590848B0.2000801@huawei.com> Date: Tue, 2 May 2017 16:52:00 +0800 From: Xishi Qiu MIME-Version: 1.0 Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash References: <59083C5B.5080204@huawei.com> <20170502084323.GG14593@dhcp22.suse.cz> In-Reply-To: <20170502084323.GG14593@dhcp22.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by kanga.kvack.org (Postfix) with ESMTP id 911A76B02F4 for ; Tue, 2 May 2017 05:16:34 -0400 (EDT) Received: by mail-wr0-f199.google.com with SMTP id g67so13056285wrd.0 for ; Tue, 02 May 2017 02:16:34 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id a33si19844776wra.282.2017.05.02.02.16.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 02:16:33 -0700 (PDT) Date: Tue, 2 May 2017 11:16:31 +0200 From: Michal Hocko Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Message-ID: <20170502091630.GH14593@dhcp22.suse.cz> References: <59083C5B.5080204@huawei.com> <20170502084323.GG14593@dhcp22.suse.cz> <590848B0.2000801@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <590848B0.2000801@huawei.com> Sender: owner-linux-mm@kvack.org List-ID: 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by kanga.kvack.org (Postfix) with ESMTP id 94A706B0350 for ; Tue, 2 May 2017 05:34:18 -0400 (EDT) Received: by mail-wm0-f69.google.com with SMTP id z129so1003960wmb.23 for ; Tue, 02 May 2017 02:34:18 -0700 (PDT) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com. [45.249.212.189]) by mx.google.com with ESMTPS id j16si19529732wrb.230.2017.05.02.02.34.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 02:34:17 -0700 (PDT) Message-ID: <590851CC.2070402@huawei.com> Date: Tue, 2 May 2017 17:30:52 +0800 From: Xishi Qiu MIME-Version: 1.0 Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash References: <59083C5B.5080204@huawei.com> <20170502084323.GG14593@dhcp22.suse.cz> <590848B0.2000801@huawei.com> <20170502091630.GH14593@dhcp22.suse.cz> In-Reply-To: <20170502091630.GH14593@dhcp22.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751472AbdEBIA6 (ORCPT ); Tue, 2 May 2017 04:00:58 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5843 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751012AbdEBIA5 (ORCPT ); Tue, 2 May 2017 04:00:57 -0400 Message-ID: <59083C5B.5080204@huawei.com> Date: Tue, 2 May 2017 15:59:23 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Andrew Morton , Mel Gorman , Vlastimil Babka , Joonsoo Kim , "Michal Hocko" , Johannes Weiner , Rik van Riel , Shakeel Butt CC: Linux MM , LKML , "zhong jiang" Subject: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.59083CAA.00D0,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8447b667a41ff6efc0f51c767c9c0649 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751344AbdEBIn1 (ORCPT ); Tue, 2 May 2017 04:43:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:33084 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750957AbdEBIn0 (ORCPT ); Tue, 2 May 2017 04:43:26 -0400 Date: Tue, 2 May 2017 10:43:23 +0200 From: Michal Hocko To: Xishi Qiu Cc: Andrew Morton , Mel Gorman , Vlastimil Babka , Joonsoo Kim , Johannes Weiner , Rik van Riel , Shakeel Butt , Linux MM , LKML , zhong jiang Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Message-ID: <20170502084323.GG14593@dhcp22.suse.cz> References: <59083C5B.5080204@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59083C5B.5080204@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751989AbdEBIxg (ORCPT ); Tue, 2 May 2017 04:53:36 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:5844 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbdEBIxc (ORCPT ); Tue, 2 May 2017 04:53:32 -0400 Message-ID: <590848B0.2000801@huawei.com> Date: Tue, 2 May 2017 16:52:00 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Michal Hocko CC: Andrew Morton , Mel Gorman , Vlastimil Babka , Joonsoo Kim , "Johannes Weiner" , Rik van Riel , Shakeel Butt , Linux MM , LKML , zhong jiang Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash References: <59083C5B.5080204@huawei.com> <20170502084323.GG14593@dhcp22.suse.cz> In-Reply-To: <20170502084323.GG14593@dhcp22.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.59084901.0148,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 374561d2617f08d4704b3fd2e495527c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751374AbdEBJRX (ORCPT ); Tue, 2 May 2017 05:17:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:38522 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750983AbdEBJQe (ORCPT ); Tue, 2 May 2017 05:16:34 -0400 Date: Tue, 2 May 2017 11:16:31 +0200 From: Michal Hocko To: Xishi Qiu Cc: Andrew Morton , Mel Gorman , Vlastimil Babka , Joonsoo Kim , Johannes Weiner , Rik van Riel , Shakeel Butt , Linux MM , LKML , zhong jiang Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash Message-ID: <20170502091630.GH14593@dhcp22.suse.cz> References: <59083C5B.5080204@huawei.com> <20170502084323.GG14593@dhcp22.suse.cz> <590848B0.2000801@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <590848B0.2000801@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751796AbdEBJdP (ORCPT ); Tue, 2 May 2017 05:33:15 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5912 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbdEBJdH (ORCPT ); Tue, 2 May 2017 05:33:07 -0400 Message-ID: <590851CC.2070402@huawei.com> Date: Tue, 2 May 2017 17:30:52 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Michal Hocko CC: Andrew Morton , Mel Gorman , Vlastimil Babka , Joonsoo Kim , "Johannes Weiner" , Rik van Riel , Shakeel Butt , Linux MM , LKML , zhong jiang Subject: Re: [RFC] dev/mem: "memtester -p 0x6c80000000000 10G" cause crash References: <59083C5B.5080204@huawei.com> <20170502084323.GG14593@dhcp22.suse.cz> <590848B0.2000801@huawei.com> <20170502091630.GH14593@dhcp22.suse.cz> In-Reply-To: <20170502091630.GH14593@dhcp22.suse.cz> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.59085241.00E5,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1255e3d209ba8929be63aadbb1b03c05 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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