mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Safonov <dsafonov@virtuozzo.com>
To: Thomas Gleixner <tglx@linutronix.de>, <hpa@zytor.com>
Cc: <linux-kernel@vger.kernel.org>, <0x7f454c46@gmail.com>,
	Adam Borowski <kilobyte@angband.pl>, <linux-mm@kvack.org>,
	Andrei Vagin <avagin@gmail.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Borislav Petkov <bp@suse.de>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	<x86@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCHv3] x86/mm: set x32 syscall bit in SET_PERSONALITY()
Date: Wed, 22 Mar 2017 16:40:08 +0300	[thread overview]
Message-ID: <1cf1ef57-94b5-68d2-4a44-0247f49d6990@virtuozzo.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1703212327170.3776@nanos>

On 03/22/2017 01:34 AM, Thomas Gleixner wrote:
> On Tue, 21 Mar 2017, hpa@zytor.com wrote:
>
>> On March 21, 2017 3:21:13 PM PDT, Thomas Gleixner <tglx@linutronix.de> wrote:
>>> On Tue, 21 Mar 2017, Dmitry Safonov wrote:
>>>> v3:
>>>> - clear x32 syscall flag during x32 -> x86-64 exec() (thanks, HPA).
>>>
>>> For correctness sake, this wants to be cleared in the IA32 path as
>>> well. It's not causing any harm, but ....
>>>
>>> I'll amend the patch.

Indeed, thanks!

>> Since the i386 syscall namespace is totally separate (and different),
>> should we simply change the system call number to the appropriate
>> sys_execve number?
>
> That should work as well and would be more intuitive.

Not sure that I got the idea correctly, something like this?
I haven't find any easy way to get compat syscall nr like
__NR_compat_execve, so I defined it there.
I'll resend v4 with the fixup if that's what was expected.

--->8---
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index b03f186369eb..c58ac0bff2f1 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -507,6 +507,8 @@ void set_personality_64bit(void)
  	current->personality &= ~READ_IMPLIES_EXEC;
  }

+#define __NR_ia32_execve	11
+
  void set_personality_ia32(bool x32)
  {
  	/* inherit personality from parent */
@@ -537,6 +539,7 @@ void set_personality_ia32(bool x32)
  			current->mm->context.ia32_compat = TIF_IA32;
  		current->personality |= force_personality32;
  		/* Prepare the first "return" to user space */
+		task_pt_regs(current)->orig_ax = __NR_ia32_execve;
  		current->thread.status |= TS_COMPAT;
  	}
  }

  reply	other threads:[~2017-03-22 13:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 17:47 Dmitry Safonov
2017-03-21 21:16 ` Adam Borowski
2017-03-21 21:23   ` hpa
2017-03-21 22:07   ` Dmitry Safonov
2017-03-21 22:21 ` Thomas Gleixner
2017-03-21 22:25   ` hpa
2017-03-21 22:34     ` Thomas Gleixner
2017-03-22 13:40       ` Dmitry Safonov [this message]
2017-03-28 11:37   ` Dmitry Safonov
2017-03-28 12:51     ` Thomas Gleixner
2017-03-28 12:59       ` Dmitry Safonov

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=1cf1ef57-94b5-68d2-4a44-0247f49d6990@virtuozzo.com \
    --to=dsafonov@virtuozzo.com \
    --cc=0x7f454c46@gmail.com \
    --cc=avagin@gmail.com \
    --cc=bp@suse.de \
    --cc=gorcunov@openvz.org \
    --cc=hpa@zytor.com \
    --cc=kilobyte@angband.pl \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®