mm: do not export ioremap_page_range symbol for external module
Subsystems (2)
PATCH v2 1/1 mm: do not export ioremap_page_range symbol for external module
From: zhong jiang <[email protected]>
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.
--- lib/ioremap.c | 1 - 1 file changed, 1 deletion(-)
lib/ioremap.c +0 -1
@@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,return err; } -EXPORT_SYMBOL_GPL (ioremap_page_range);
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 15 lines · zhongjiang
From: zhong jiang <[email protected]>
Recently, I've found cases in which
ioremap_page_rangewas used incorrectly, in external modules, leading to crashes. This can be partly attributed to the fact thatioremap_page_rangeis 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
Quoted 8 lines
...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 <[email protected]>Reviewed-by John Hubbard <[email protected]>Suggested-by John Hubbard <[email protected]>
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.
Quoted 15 lines
--- lib/ioremap.c | 1 - 1 file changed, 1 deletion(-)lib/ioremap.c +0
-1@@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,return err; } -EXPORT_SYMBOL_GPL (ioremap_page_range);Signature · 1 line
1.8.3.1
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 21 lines · Michal Hocko
Quoted 20 lines · zhongjiang
From: zhong jiang <[email protected]>
Recently, I've found cases in which
ioremap_page_rangewas used incorrectly, in external modules, leading to crashes. This can be partly attributed to the fact thatioremap_page_rangeis 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.
Quoted 7 lines
Quoted 3 lines
Signed-off-by zhong jiang <[email protected]>Reviewed-by John Hubbard <[email protected]>Suggested-by John Hubbard <[email protected]>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
Quoted 12 lines
Other than that this looks reasonably to me.
Quoted 10 lines
--- lib/ioremap.c | 1 - 1 file changed, 1 deletion(-)lib/ioremap.c +0
-0@@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
Quoted 5 lines
Quoted 5 lines
lib/ioremap.c +0
-1return err; } -EXPORT_SYMBOL_GPL (ioremap_page_range);Signature · 1 line
1.8.3.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Michal Hocko
Acked-byQuoted 22 lines · zhong jiang
Quoted 21 lines · Michal Hocko
Quoted 20 lines · zhongjiang
From: zhong jiang <[email protected]>
Recently, I've found cases in which
ioremap_page_rangewas used incorrectly, in external modules, leading to crashes. This can be partly attributed to the fact thatioremap_page_rangeis 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.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Signed-off-by zhong jiang <[email protected]>Reviewed-by John Hubbard <[email protected]>Suggested-by John Hubbard <[email protected]>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
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 31 lines · Michal Hocko
Quoted 22 lines · zhong jiang
Quoted 21 lines · Michal Hocko
Quoted 20 lines · zhongjiang
From: zhong jiang <[email protected]>
Recently, I've found cases in which
ioremap_page_rangewas used incorrectly, in external modules, leading to crashes. This can be partly attributed to the fact thatioremap_page_rangeis 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.Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Signed-off-by zhong jiang <[email protected]>Reviewed-by John Hubbard <[email protected]>Suggested-by John Hubbard <[email protected]>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.
Quoted 8 lines
OK, it seems you are right. Both
PCI_TEGRAandACPI_APEI_GHESare either disabled or compiled in. The same applies fordrivers/pci/pci.c. This wasn't the case at the time when the export was introduced asACPI_APEI_GHESused to be tristate until86cd47334b00("ACPI, APEI, GHES, Prevent GHES to be built as module").You can add
Acked-by Michal Hocko <[email protected]>
Thanks a lot.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>