lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-67dece7d4c5841e84a3c795e79bf0dcd5be54f55@git.kernel.org>
Date:   Thu, 27 Oct 2016 23:49:25 -0700
From:   tip-bot for Dmitry Safonov <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, jpoimboe@...hat.com, luto@...nel.org,
        brgerst@...il.com, dvlasenk@...hat.com, mingo@...nel.org,
        a.p.zijlstra@...llo.nl, torvalds@...ux-foundation.org,
        gorcunov@...nvz.org, hpa@...or.com, dsafonov@...tuozzo.com,
        bp@...en8.de, peterz@...radead.org, tglx@...utronix.de
Subject: [tip:x86/asm] x86/vdso: Set vDSO pointer only after success

Commit-ID:  67dece7d4c5841e84a3c795e79bf0dcd5be54f55
Gitweb:     http://git.kernel.org/tip/67dece7d4c5841e84a3c795e79bf0dcd5be54f55
Author:     Dmitry Safonov <dsafonov@...tuozzo.com>
AuthorDate: Thu, 27 Oct 2016 17:15:16 +0300
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 28 Oct 2016 08:15:55 +0200

x86/vdso: Set vDSO pointer only after success

Those pointers were initialized before call to _install_special_mapping()
after the commit:

  f7b6eb3fa072 ("x86: Set context.vdso before installing the mapping")

This is not required anymore as special mappings have their vma name and
don't use arch_vma_name() after commit:

  a62c34bd2a8a ("x86, mm: Improve _install_special_mapping and fix x86 vdso naming")

So, this way to init looks less entangled.

I even belive that we can remove NULL initializers:

 - on failure load_elf_binary() will not start a new thread;
 - arch_prctl will have the same pointers as before syscall.

Signed-off-by: Dmitry Safonov <dsafonov@...tuozzo.com>
Acked-by: Andy Lutomirski <luto@...nel.org>
Cc: 0x7f454c46@...il.com
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Cyrill Gorcunov <gorcunov@...nvz.org>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-mm@...ck.org
Cc: oleg@...hat.com
Link: http://lkml.kernel.org/r/20161027141516.28447-3-dsafonov@virtuozzo.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 arch/x86/entry/vdso/vma.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index 23c881c..e739002 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -161,8 +161,6 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr)
 	}
 
 	text_start = addr - image->sym_vvar_start;
-	current->mm->context.vdso = (void __user *)text_start;
-	current->mm->context.vdso_image = image;
 
 	/*
 	 * MAYWRITE to allow gdb to COW and set breakpoints
@@ -189,14 +187,12 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr)
 	if (IS_ERR(vma)) {
 		ret = PTR_ERR(vma);
 		do_munmap(mm, text_start, image->size);
+	} else {
+		current->mm->context.vdso = (void __user *)text_start;
+		current->mm->context.vdso_image = image;
 	}
 
 up_fail:
-	if (ret) {
-		current->mm->context.vdso = NULL;
-		current->mm->context.vdso_image = NULL;
-	}
-
 	up_write(&mm->mmap_sem);
 	return ret;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ