uprobes: use kzalloc to allocate xol area
Subsystems (3)
PATCH 1/1 uprobes: use kzalloc to allocate xol area
To prevent unitialized members, use kzalloc to allocate the xol area.
Signed-off-by Sven Schnelle <[email protected]>
--- kernel/events/uprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/events/uprobes.c +1 -2
@@ -1489,7 +1489,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)struct xol_area *area;void *insns; - area =kmalloc (sizeof (*area),GFP_KERNEL ); + area =kzalloc (sizeof (*area),GFP_KERNEL );if (unlikely (!area)) goto out;
@@ -1499,7 +1499,6 @@ static struct xol_area *__create_xol_area(unsigned long vaddr) goto free_area; area->xol_mapping.name ="[uprobes]" ; - area->xol_mapping.fault =NULL ; area->xol_mapping.pages = area->pages; area->pages[0 ] =alloc_page (GFP_HIGHUSER );if (!area->pages[0 ])
Signature · 1 line
2.43.0
Quoted 5 lines · Sven Schnelle
To prevent unitialized members, use kzalloc to allocate the xol area.
Signed-off-by Sven Schnelle <[email protected]>
Acked-by Oleg Nesterov <[email protected]>
and since this looks easily exploitable, I'd sugest
Fixes b059a453b1cf1 ("x86/vdso: Add mremap hook to vm_special_mapping")
Quoted 28 lines
--- kernel/events/uprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)kernel/events/uprobes.c +1
-2@@ -1489,7 +1489,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)struct xol_area *area;void *insns; - area =kmalloc (sizeof (*area),GFP_KERNEL ); + area =kzalloc (sizeof (*area),GFP_KERNEL );if (unlikely (!area)) goto out;@@ -1499,7 +1499,6 @@ static struct xol_area *__create_xol_area(unsigned long vaddr) goto free_area; area->xol_mapping.name ="[uprobes]" ; - area->xol_mapping.fault =NULL ; area->xol_mapping.pages = area->pages; area->pages[0 ] =alloc_page (GFP_HIGHUSER );if (!area->pages[0 ])Signature · 1 line
2.43.0
Peter Zijlstra
maintainerQuoted 5 lines · Oleg Nesterov
Quoted 4 lines · Sven Schnelle
To prevent unitialized members, use kzalloc to allocate the xol area.
Quoted 8 lines
Quoted 1 line
Signed-off-by Sven Schnelle <[email protected]>Acked-by Oleg Nesterov <[email protected]>and since this looks easily exploitable, I'd sugest
Fixes b059a453b1cf1 ("x86/vdso: Add mremap hook to vm_special_mapping")
Thanks, will queue in perf/urgent
[tip: perf/urgent] uprobes: Use kzalloc to allocate xol area
In reply to Sven SchnelleThe following commit has been merged into the perf/urgent branch of tip:
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: e240b0fde52f33670d1336697c22d90a4fe33c84 Gitweb: https://git.kernel.org/tip/e240b0fde52f33670d1336697c22d90a4fe33c84 Author: Sven Schnelle <[email protected]> AuthorDate: Tue, 03 Sep 2024 12:23:12 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 03 Sep 2024 16:54:02 +02:00
uprobes: Use kzalloc to allocate xol area
To prevent unitialized members, use kzalloc to allocate the xol area.
Fixes b059a453b1cf1 ("x86/vdso: Add mremap hook to vm_special_mapping")
Signed-off-by Sven Schnelle <[email protected]>
Signed-off-by Peter Zijlstra (Intel) <[email protected]>
Acked-by Oleg Nesterov <[email protected]>
--- kernel/events/uprobes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/events/uprobes.c +1 -2
@@ -1489,7 +1489,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)struct xol_area *area;void *insns; - area =kmalloc (sizeof (*area),GFP_KERNEL ); + area =kzalloc (sizeof (*area),GFP_KERNEL );if (unlikely (!area)) goto out;
@@ -1499,7 +1499,6 @@ static struct xol_area *__create_xol_area(unsigned long vaddr) goto free_area; area->xol_mapping.name ="[uprobes]" ; - area->xol_mapping.fault =NULL ; area->xol_mapping.pages = area->pages; area->pages[0 ] =alloc_page (GFP_HIGHUSER );if (!area->pages[0 ])