Skip to contentSkip to conversation

mm: do not export ioremap_page_range symbol for external module

PATCH Applied zhongjiang 2 participants 5 messages Jan 23, 2017 – Jan 24, 2017

Subsystems (2)
lore
Share & tools
lore

zhongjiang

author
#0 lore raw

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
index 86c8911..a3e14ce 100644
@@ -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>
#1 lore raw
Quoted 15 lines · zhongjiang

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

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.

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
index 86c8911..a3e14ce 100644
@@ -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>
#2 lore raw
Quoted 21 lines · Michal Hocko
Quoted 20 lines · zhongjiang

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.

Quoted 7 lines
Quoted 3 lines

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
index 86c8911..a3e14ce 100644
@@ -144,4 +144,3 @@ int ioremap_page_range(unsigned long addr,
 
Quoted 5 lines
Quoted 5 lines
lib/ioremap.c +0 -1
 	return 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>

Acked-by
#3 lore raw
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_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.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

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>
#4 lore raw
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_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.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

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

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>