mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86, vdso32: fix out of memory handling setup vDSO
@ 2014-03-20  7:45 Stefani Seibold
  2014-03-20  9:53 ` Thomas Gleixner
  0 siblings, 1 reply; 13+ messages in thread
From: Stefani Seibold @ 2014-03-20  7:45 UTC (permalink / raw)
  To: gregkh, linux-kernel, x86, tglx, mingo, hpa, ak, aarcange,
	john.stultz, luto, xemul, gorcunov, andriy.shevchenko
  Cc: Martin.Runge, Andreas.Brief, Stefani Seibold

This patch add a correct out of memory handling for setup a 32 bit vDSO.

The patch is against tip commit 4e40112c4ff6a577dd06d92b2a54cdf06265bf74

Signed-off-by: Stefani Seibold <stefani@seibold.net>
---
 arch/x86/vdso/vdso32-setup.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 0bc363a..e1171c2 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -134,8 +134,14 @@ int __init sysenter_setup(void)
 	}
 
 	vdso32_size = (vdso_len + PAGE_SIZE - 1) / PAGE_SIZE;
-	vdso32_pages = kmalloc(sizeof(*vdso32_pages) * vdso32_size, GFP_ATOMIC); 
+
+	vdso32_pages = kmalloc(sizeof(*vdso32_pages) * vdso32_size, GFP_ATOMIC);
+	if (!vdso32_pages)
+		goto fail;
+
 	vdso_pages = kmalloc(VDSO_OFFSET(vdso32_size), GFP_ATOMIC);
+	if (!vdso_pages)
+		goto fail;
 
 	for(i = 0; i != vdso32_size; ++i)
 		vdso32_pages[i] = virt_to_page(vdso_pages + VDSO_OFFSET(i));
@@ -144,6 +150,12 @@ int __init sysenter_setup(void)
 	patch_vdso32(vdso_pages, vdso_len);
 
 	return 0;
+fail:
+	kfree(vdso32_pages);
+	kfree(vdso_pages);
+	vdso32_size = 0;
+
+	return -ENOMEM;
 }
 
 /* Setup a VMA at program startup for the vsyscall page */
@@ -162,6 +174,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 	if (vdso_enabled != 1)  /* Other values all mean "disabled" */
 		return 0;
 
+	if (!vdso32_size)
+		return 0;
+
 	down_write(&mm->mmap_sem);
 
 	addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0);
-- 
1.9.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-03-20 22:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-20  7:45 [PATCH] x86, vdso32: fix out of memory handling setup vDSO Stefani Seibold
2014-03-20  9:53 ` Thomas Gleixner
2014-03-20 10:49   ` Thomas Gleixner
2014-03-20 11:38   ` Stefani Seibold
2014-03-20 12:30     ` Thomas Gleixner
2014-03-20 15:02       ` Andy Lutomirski
2014-03-20 15:15         ` Thomas Gleixner
2014-03-20 15:18           ` Andy Lutomirski
2014-03-20 15:59             ` H. Peter Anvin
2014-03-20 16:56               ` Andy Lutomirski
2014-03-20 17:06                 ` H. Peter Anvin
2014-03-20 22:01                 ` [PATCH] x86: Load the 32-bit vdso in place, just like the 64-bit vdsos Andy Lutomirski
2014-03-20 22:30                   ` [tip:x86/vdso] " tip-bot for Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome