linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm: do not export ioremap_page_range symbol for external module
@ 2017-01-23 12:07 zhongjiang
  2017-01-24 10:23 ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: zhongjiang @ 2017-01-23 12:07 UTC (permalink / raw)
  To: akpm, jhubbard; +Cc: linux-mm, minchan, mhocko

From: zhong jiang <zhongjiang@huawei.com>

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.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com> 
Suggested-by: John Hubbard <jhubbard@nvidia.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

--
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] 5+ messages in thread

* Re: [PATCH v2] mm: do not export ioremap_page_range symbol for external module
  2017-01-23 12:07 [PATCH v2] mm: do not export ioremap_page_range symbol for external module zhongjiang
@ 2017-01-24 10:23 ` Michal Hocko
  2017-01-24 13:00   ` zhong jiang
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2017-01-24 10:23 UTC (permalink / raw)
  To: zhongjiang; +Cc: akpm, jhubbard, linux-mm, minchan

On Mon 23-01-17 20:07:00, zhongjiang wrote:
> From: zhong jiang <zhongjiang@huawei.com>
> 
> 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.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> Reviewed-by: John Hubbard <jhubbard@nvidia.com> 
> Suggested-by: John Hubbard <jhubbard@nvidia.com>

git grep says that there are few direct users of this API in the tree.
Have you checked all of them? The export has been added by 81e88fdc432a
("ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification
type support").

Other than that this looks reasonably to me.

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

-- 
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] 5+ messages in thread

* Re: [PATCH v2] mm: do not export ioremap_page_range symbol for external module
  2017-01-24 10:23 ` Michal Hocko
@ 2017-01-24 13:00   ` zhong jiang
  2017-01-24 13:15     ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: zhong jiang @ 2017-01-24 13:00 UTC (permalink / raw)
  To: Michal Hocko; +Cc: akpm, jhubbard, linux-mm, minchan

On 2017/1/24 18:23, Michal Hocko wrote:
> On Mon 23-01-17 20:07:00, zhongjiang wrote:
>> From: zhong jiang <zhongjiang@huawei.com>
>>
>> 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.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> Reviewed-by: John Hubbard <jhubbard@nvidia.com> 
>> Suggested-by: John Hubbard <jhubbard@nvidia.com>
> git grep says that there are few direct users of this API in the tree.
> Have you checked all of them? The export has been added by 81e88fdc432a
> ("ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification
> type support").
  I have checked more than one times.  and John also have looked through the whole own kernel.

  Thanks
  zhongjiang
> Other than that this looks reasonably to me.
>
>> ---
>>  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


--
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] 5+ messages in thread

* Re: [PATCH v2] mm: do not export ioremap_page_range symbol for external module
  2017-01-24 13:00   ` zhong jiang
@ 2017-01-24 13:15     ` Michal Hocko
  2017-01-24 13:26       ` zhong jiang
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2017-01-24 13:15 UTC (permalink / raw)
  To: zhong jiang; +Cc: akpm, jhubbard, linux-mm, minchan

On Tue 24-01-17 21:00:24, zhong jiang wrote:
> On 2017/1/24 18:23, Michal Hocko wrote:
> > On Mon 23-01-17 20:07:00, zhongjiang wrote:
> >> From: zhong jiang <zhongjiang@huawei.com>
> >>
> >> 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.
> >>
> >> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> >> Reviewed-by: John Hubbard <jhubbard@nvidia.com> 
> >> Suggested-by: John Hubbard <jhubbard@nvidia.com>
> > git grep says that there are few direct users of this API in the tree.
> > Have you checked all of them? The export has been added by 81e88fdc432a
> > ("ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification
> > type support").
>   I have checked more than one times.  and John also have looked through the whole own kernel.

OK, it seems you are right. Both PCI_TEGRA and ACPI_APEI_GHES are either
disabled or compiled in. The same applies for drivers/pci/pci.c.
This wasn't the case at the time when the export was introduced as
ACPI_APEI_GHES used to be tristate until 86cd47334b00 ("ACPI, APEI,
GHES, Prevent GHES to be built as module").

You can add
Acked-by: Michal Hocko <mhocko@suse.com>
-- 
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] 5+ messages in thread

* Re: [PATCH v2] mm: do not export ioremap_page_range symbol for external module
  2017-01-24 13:15     ` Michal Hocko
@ 2017-01-24 13:26       ` zhong jiang
  0 siblings, 0 replies; 5+ messages in thread
From: zhong jiang @ 2017-01-24 13:26 UTC (permalink / raw)
  To: Michal Hocko; +Cc: akpm, jhubbard, linux-mm, minchan

On 2017/1/24 21:15, Michal Hocko wrote:
> On Tue 24-01-17 21:00:24, zhong jiang wrote:
>> On 2017/1/24 18:23, Michal Hocko wrote:
>>> On Mon 23-01-17 20:07:00, zhongjiang wrote:
>>>> From: zhong jiang <zhongjiang@huawei.com>
>>>>
>>>> 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.
>>>>
>>>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>>>> Reviewed-by: John Hubbard <jhubbard@nvidia.com> 
>>>> Suggested-by: John Hubbard <jhubbard@nvidia.com>
>>> git grep says that there are few direct users of this API in the tree.
>>> Have you checked all of them? The export has been added by 81e88fdc432a
>>> ("ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification
>>> type support").
>>   I have checked more than one times.  and John also have looked through the whole own kernel.
> OK, it seems you are right. Both PCI_TEGRA and ACPI_APEI_GHES are either
> disabled or compiled in. The same applies for drivers/pci/pci.c.
> This wasn't the case at the time when the export was introduced as
> ACPI_APEI_GHES used to be tristate until 86cd47334b00 ("ACPI, APEI,
> GHES, Prevent GHES to be built as module").
>
> You can add
> Acked-by: Michal Hocko <mhocko@suse.com>
 Thanks a lot.

--
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] 5+ messages in thread

end of thread, other threads:[~2017-01-24 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 12:07 [PATCH v2] mm: do not export ioremap_page_range symbol for external module zhongjiang
2017-01-24 10:23 ` Michal Hocko
2017-01-24 13:00   ` zhong jiang
2017-01-24 13:15     ` Michal Hocko
2017-01-24 13:26       ` zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox