linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Dmitry Safonov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, jpoimboe@redhat.com,
	luto@kernel.org, brgerst@gmail.com, dvlasenk@redhat.com,
	mingo@kernel.org, a.p.zijlstra@chello.nl,
	torvalds@linux-foundation.org, gorcunov@openvz.org,
	hpa@zytor.com, dsafonov@virtuozzo.com, bp@alien8.de,
	peterz@infradead.org, tglx@linutronix.de
Subject: [tip:x86/asm] x86/vdso: Set vDSO pointer only after success
Date: Thu, 27 Oct 2016 23:49:25 -0700	[thread overview]
Message-ID: <tip-67dece7d4c5841e84a3c795e79bf0dcd5be54f55@git.kernel.org> (raw)
In-Reply-To: <20161027141516.28447-3-dsafonov@virtuozzo.com>

Commit-ID:  67dece7d4c5841e84a3c795e79bf0dcd5be54f55
Gitweb:     http://git.kernel.org/tip/67dece7d4c5841e84a3c795e79bf0dcd5be54f55
Author:     Dmitry Safonov <dsafonov@virtuozzo.com>
AuthorDate: Thu, 27 Oct 2016 17:15:16 +0300
Committer:  Ingo Molnar <mingo@kernel.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@virtuozzo.com>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: 0x7f454c46@gmail.com
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Cc: oleg@redhat.com
Link: http://lkml.kernel.org/r/20161027141516.28447-3-dsafonov@virtuozzo.com
Signed-off-by: Ingo Molnar <mingo@kernel.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;
 }

      parent reply	other threads:[~2016-10-28  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 14:15 [PATCH 0/2] x86/vdso: small fixups for map_vdso Dmitry Safonov
2016-10-27 14:15 ` [PATCH 1/2] x86/prctl/uapi: remove ifdef for CHECKPOINT_RESTORE Dmitry Safonov
2016-10-28  6:48   ` [tip:x86/asm] x86/prctl/uapi: Remove #ifdef " tip-bot for Dmitry Safonov
2016-10-27 14:15 ` [PATCH 2/2] x86/vdso: set vdso pointer only after success Dmitry Safonov
2016-10-27 22:25   ` Andy Lutomirski
2016-10-28  6:49   ` tip-bot for Dmitry Safonov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-67dece7d4c5841e84a3c795e79bf0dcd5be54f55@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dsafonov@virtuozzo.com \
    --cc=dvlasenk@redhat.com \
    --cc=gorcunov@openvz.org \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).