linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: do not export ioremap_page_range symbol for external module
@ 2017-01-22 12:58 zhongjiang
  2017-01-22 22:25 ` John Hubbard
  2017-01-23  1:14 ` zhong jiang
  0 siblings, 2 replies; 5+ messages in thread
From: zhongjiang @ 2017-01-22 12:58 UTC (permalink / raw)
  To: akpm, minchan, mhocko; +Cc: linux-mm, linux-kernel

From: zhong jiang <zhongjiang@huawei.com>

Recently, I find the ioremap_page_range had been abusing. The improper
address mapping is a issue. it will result in the crash. so, remove
the symbol. It can be replaced by the ioremap_cache or others symbol.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 lib/ioremap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/ioremap.c b/lib/ioremap.c
index 86c8911..a3e14ce 100644
--- a/lib/ioremap.c
+++ b/lib/ioremap.c
@@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
 
 	return err;
 }
-EXPORT_SYMBOL_GPL(ioremap_page_range);
-- 
1.8.3.1

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

* Re: [PATCH] mm: do not export ioremap_page_range symbol for external module
  2017-01-22 12:58 [PATCH] mm: do not export ioremap_page_range symbol for external module zhongjiang
@ 2017-01-22 22:25 ` John Hubbard
  2017-01-23  1:14 ` zhong jiang
  1 sibling, 0 replies; 5+ messages in thread
From: John Hubbard @ 2017-01-22 22:25 UTC (permalink / raw)
  To: zhongjiang, akpm, minchan, mhocko; +Cc: linux-mm, linux-kernel

On 01/22/2017 04:58 AM, zhongjiang wrote:
> From: zhong jiang <zhongjiang@huawei.com>
>
> Recently, I find the ioremap_page_range had been abusing. The improper
> address mapping is a issue. it will result in the crash. so, remove
> the symbol. It can be replaced by the ioremap_cache or others symbol.

Hi Zhong,

After thinking about this for a bit, and looking through our own (out-of-tree) kernel modules, I 
think you have a good point. I just can't see any reason for a driver to call ioremap_page_range 
directly. So the code change looks good to me.

For the commit description, here is a proposed re-wording, optional, that perhaps may be a little 
clearer. See if you like it?

-------
Recently, I've found cases in which ioremap_page_range was used incorrectly, in external modules, 
leading to crashes. This can be partly attributed to the fact that ioremap_page_range is 
lower-level, with fewer protections, as compared to the other functions that an external module 
would typically call. Those include:

         ioremap_cache
         ioremap_nocache
         ioremap_prot
         ioremap_uc
         ioremap_wc
         ioremap_wt

...each of which wraps __ioremap_caller, which in turn provides a safer way to achieve the mapping.

Therefore, stop EXPORT-ing ioremap_page_range.
-------

I may get some heat for this if another out-of-tree driver needs that symbol, but if no one else 
pops up and shrieks, you can add:

Reviewed-by: John Hubbard <jhubbard@nvidia.com>

thanks,
john h


>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  lib/ioremap.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/lib/ioremap.c b/lib/ioremap.c
> index 86c8911..a3e14ce 100644
> --- a/lib/ioremap.c
> +++ b/lib/ioremap.c
> @@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
>
>  	return err;
>  }
> -EXPORT_SYMBOL_GPL(ioremap_page_range);
> --
> 1.8.3.1
>

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

* Re: [PATCH] mm: do not export ioremap_page_range symbol for external module
  2017-01-22 12:58 [PATCH] mm: do not export ioremap_page_range symbol for external module zhongjiang
  2017-01-22 22:25 ` John Hubbard
@ 2017-01-23  1:14 ` zhong jiang
  2017-01-23  1:30   ` John Hubbard
  1 sibling, 1 reply; 5+ messages in thread
From: zhong jiang @ 2017-01-23  1:14 UTC (permalink / raw)
  To: akpm, minchan, mhocko; +Cc: linux-mm, linux-kernel

On 2017/1/22 20:58, zhongjiang wrote:
> From: zhong jiang <zhongjiang@huawei.com>
>
> Recently, I find the ioremap_page_range had been abusing. The improper
> address mapping is a issue. it will result in the crash. so, remove
> the symbol. It can be replaced by the ioremap_cache or others symbol.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  lib/ioremap.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/lib/ioremap.c b/lib/ioremap.c
> index 86c8911..a3e14ce 100644
> --- a/lib/ioremap.c
> +++ b/lib/ioremap.c
> @@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
>  
>  	return err;
>  }
> -EXPORT_SYMBOL_GPL(ioremap_page_range);
self nack

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

* Re: [PATCH] mm: do not export ioremap_page_range symbol for external module
  2017-01-23  1:14 ` zhong jiang
@ 2017-01-23  1:30   ` John Hubbard
  2017-01-23 11:52     ` zhong jiang
  0 siblings, 1 reply; 5+ messages in thread
From: John Hubbard @ 2017-01-23  1:30 UTC (permalink / raw)
  To: zhong jiang, akpm, minchan, mhocko; +Cc: linux-mm, linux-kernel



On 01/22/2017 05:14 PM, zhong jiang wrote:
> On 2017/1/22 20:58, zhongjiang wrote:
>> From: zhong jiang <zhongjiang@huawei.com>
>>
>> Recently, I find the ioremap_page_range had been abusing. The improper
>> address mapping is a issue. it will result in the crash. so, remove
>> the symbol. It can be replaced by the ioremap_cache or others symbol.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  lib/ioremap.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/lib/ioremap.c b/lib/ioremap.c
>> index 86c8911..a3e14ce 100644
>> --- a/lib/ioremap.c
>> +++ b/lib/ioremap.c
>> @@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
>>
>>  	return err;
>>  }
>> -EXPORT_SYMBOL_GPL(ioremap_page_range);
> self nack
>

heh. What changed your mind?

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

* Re: [PATCH] mm: do not export ioremap_page_range symbol for external module
  2017-01-23  1:30   ` John Hubbard
@ 2017-01-23 11:52     ` zhong jiang
  0 siblings, 0 replies; 5+ messages in thread
From: zhong jiang @ 2017-01-23 11:52 UTC (permalink / raw)
  To: John Hubbard; +Cc: akpm, minchan, mhocko, linux-mm, linux-kernel

On 2017/1/23 9:30, John Hubbard wrote:
>
>
> On 01/22/2017 05:14 PM, zhong jiang wrote:
>> On 2017/1/22 20:58, zhongjiang wrote:
>>> From: zhong jiang <zhongjiang@huawei.com>
>>>
>>> Recently, I find the ioremap_page_range had been abusing. The improper
>>> address mapping is a issue. it will result in the crash. so, remove
>>> the symbol. It can be replaced by the ioremap_cache or others symbol.
>>>
>>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>>> ---
>>>  lib/ioremap.c | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/lib/ioremap.c b/lib/ioremap.c
>>> index 86c8911..a3e14ce 100644
>>> --- a/lib/ioremap.c
>>> +++ b/lib/ioremap.c
>>> @@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
>>>
>>>      return err;
>>>  }
>>> -EXPORT_SYMBOL_GPL(ioremap_page_range);
>> self nack
>>
>
> heh. What changed your mind?
>
  Very sorry,  I mistake own kernel modules call it directly.  Thank you review
  the patch . I will take your changelog and send it in v2.

  Thanks
  zhongjiang
> .
>

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

end of thread, other threads:[~2017-01-23 11:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-22 12:58 [PATCH] mm: do not export ioremap_page_range symbol for external module zhongjiang
2017-01-22 22:25 ` John Hubbard
2017-01-23  1:14 ` zhong jiang
2017-01-23  1:30   ` John Hubbard
2017-01-23 11:52     ` zhong jiang

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