Manually rebuild hack patches: - 200-tools_portability.patch - 204-module_strip.patch - 230-openwrt_lzma_options.patch - 251-kconfig.patch - 259-regmap_dynamic.patch - 301-01-mm-permit-to-declare-custom-execmem-alloc-free-funct.patch - 301-02-mips-replace-mlong-calls-with-mno-long-calls-if-poss.patch - 430-mtk-bmt-support.patch - 721-net-add-packet-mangeling.patch - 722-net-phy-aquantia-enable-AQR112-and-AQR412.patch - 725-net-phy-aquantia-add-PHY_IDs-for-AQR112-variants.patch - 750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch - 800-GPIO-add-named-gpio-exports.patch - 902-debloat_proc.patch - 904-debloat_dma_buf.patch Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/21078 Signed-off-by: Robert Marko <robimarko@gmail.com>
64 lines
2.0 KiB
Diff
64 lines
2.0 KiB
Diff
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Mon, 14 Apr 2025 18:04:25 +0200
|
|
Subject: [PATCH 1/2] mm: permit to declare custom execmem alloc/free function
|
|
|
|
Permit to declare custom execmem alloc/free function that bypass the
|
|
execmem API. This works by making the alloc/free function weak
|
|
permitting an arch to declare a replacement for them.
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
Co-authored-by: Shiji Yang <yangshiji66@outlook.com>
|
|
---
|
|
include/linux/moduleloader.h | 4 ++++
|
|
mm/execmem.c | 14 ++++++++++++--
|
|
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
--- a/include/linux/moduleloader.h
|
|
+++ b/include/linux/moduleloader.h
|
|
@@ -122,4 +122,8 @@ void module_arch_cleanup(struct module *
|
|
/* Any cleanup before freeing mod->module_init */
|
|
void module_arch_freeing_init(struct module *mod);
|
|
|
|
+enum execmem_type;
|
|
+void *arch_execmem_alloc(enum execmem_type type, size_t size);
|
|
+void arch_execmem_free(void *ptr);
|
|
+
|
|
#endif
|
|
--- a/mm/execmem.c
|
|
+++ b/mm/execmem.c
|
|
@@ -458,7 +458,7 @@ static bool execmem_cache_free(void *ptr
|
|
}
|
|
#endif /* CONFIG_ARCH_HAS_EXECMEM_ROX */
|
|
|
|
-void *execmem_alloc(enum execmem_type type, size_t size)
|
|
+void *__weak arch_execmem_alloc(enum execmem_type type, size_t size)
|
|
{
|
|
struct execmem_range *range = &execmem_info->ranges[type];
|
|
bool use_cache = range->flags & EXECMEM_ROX_CACHE;
|
|
@@ -491,7 +491,12 @@ void *execmem_alloc_rw(enum execmem_type
|
|
return no_free_ptr(p);
|
|
}
|
|
|
|
-void execmem_free(void *ptr)
|
|
+void *execmem_alloc(enum execmem_type type, size_t size)
|
|
+{
|
|
+ return arch_execmem_alloc(type, size);
|
|
+}
|
|
+
|
|
+void __weak arch_execmem_free(void *ptr)
|
|
{
|
|
/*
|
|
* This memory may be RO, and freeing RO memory in an interrupt is not
|
|
@@ -508,6 +513,11 @@ bool execmem_is_rox(enum execmem_type ty
|
|
return !!(execmem_info->ranges[type].flags & EXECMEM_ROX_CACHE);
|
|
}
|
|
|
|
+void execmem_free(void *ptr)
|
|
+{
|
|
+ arch_execmem_free(ptr);
|
|
+}
|
|
+
|
|
static bool execmem_validate(struct execmem_info *info)
|
|
{
|
|
struct execmem_range *r = &info->ranges[EXECMEM_DEFAULT];
|