module: release codetag section when module load fails
PATCH 1/1 module: release codetag section when module load fails
When module load failed after memory for codetag sections ready, codetag section memory was not properly released. This causes memory leak, and if next module load happens to got the same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and lead to "unable to handle page fault" BUG.
--- kernel/module/main.c | 1 + 1 file changed, 1 insertion(+)
kernel/module/main.c +1 -0
@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) {percpu_modfree (mod);module_arch_freeing_init (mod); +codetag_free_module_sections (mod);free_mod_mem (mod); }
Signature · 1 line
2.39.2
Quoted 2 lines · David Wang
When module load failed after memory for codetag sections ready,
nit: s/ready/is ready
Quoted 2 lines
codetag section memory was not properly released. This causes memory leak, and if next module load happens to got the
nit: s/happens to got/happens to get
Quoted 6 lines
same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and lead to "unable to handle page fault" BUG.
Signed-off-by David Wang <[email protected]>
Quoted 19 lines
--- kernel/module/main.c | 1 + 1 file changed, 1 insertion(+)kernel/module/main.c +1
-1@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) {percpu_modfree (mod);module_arch_freeing_init (mod); +codetag_free_module_sections (mod);free_mod_mem (mod); } --2.39.2
Quoted 11 lines · Suren Baghdasaryan
Quoted 2 lines · David Wang
When module load failed after memory for codetag sections ready,
nit: s/ready/is ready
Quoted 2 lines
codetag section memory was not properly released. This causes memory leak, and if next module load happens to got the
nit: s/happens to got/happens to get
Thanks, I will send new version.
Quoted 29 lines
Quoted 7 lines
same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and lead to "unable to handle page fault" BUG.
Signed-off-by David Wang <[email protected]>Quoted 19 lines
--- kernel/module/main.c | 1 + 1 file changed, 1 insertion(+)kernel/module/main.c +1
-1@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) {percpu_modfree (mod);module_arch_freeing_init (mod); +codetag_free_module_sections (mod);free_mod_mem (mod); } --2.39.2
PATCH v2 1/1 module: release codetag section when module load fails
In reply to David WangWhen module load fails after memory for codetag section is ready, codetag section memory will not be properly released. This causes memory leak, and if next module load happens to get the same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and leads to "unable to handle page fault" BUG.
--- kernel/module/main.c | 1 + 1 file changed, 1 insertion(+)
kernel/module/main.c +1 -0
@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) {percpu_modfree (mod);module_arch_freeing_init (mod); +codetag_free_module_sections (mod);free_mod_mem (mod); }
Signature · 1 line
2.39.2
Quoted 11 lines · David Wang
When module load fails after memory for codetag section is ready, codetag section memory will not be properly released. This causes memory leak, and if next module load happens to get the same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and leads to "unable to handle page fault" BUG.
Signed-off-by David Wang <[email protected]>
Sending to Andrew for adding into the mm tree.
Quoted 19 lines
--- kernel/module/main.c | 1 + 1 file changed, 1 insertion(+)kernel/module/main.c +1
-1@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) {percpu_modfree (mod);module_arch_freeing_init (mod); +codetag_free_module_sections (mod);free_mod_mem (mod); } --2.39.2
Quoted 10 lines · Suren Baghdasaryan
Quoted 8 lines · David Wang
When module load fails after memory for codetag section is ready, codetag section memory will not be properly released. This causes memory leak, and if next module load happens to get the same module address, codetag may pick the uninitialized section when manipulating tags during module unload, and leads to "unable to handle page fault" BUG.
contiguous memory")
Quoted 25 lines
Quoted 3 lines
Signed-off-by David Wang <[email protected]>Sending to Andrew for adding into the mm tree.
Quoted 19 lines
--- kernel/module/main.c | 1 + 1 file changed, 1 insertion(+)kernel/module/main.c +1
-1@@ -2829,6 +2829,7 @@ static void module_deallocate(struct module *mod, struct load_info *info) {percpu_modfree (mod);module_arch_freeing_init (mod); +codetag_free_module_sections (mod);free_mod_mem (mod); } --2.39.2