linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiongwei Song <sxwjean@me.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, linux-mm@kvack.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>,
	Gabriel Krisman Bertazi <krisman@collabora.com>,
	"Chang S. Bae" <chang.seok.bae@intel.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Arvind Sankar <nivedita@alum.mit.edu>,
	adobriyan@gmail.com, oleg@redhat.com, sblbir@amazon.com,
	axboe@kernel.dk, laijs@linux.alibaba.com,
	dave.hansen@linux.intel.com, akpm@linux-foundation.org,
	arnd@arndb.de, davem@davemloft.net, keescook@chromium.org,
	kim.phillips@amd.com, yazen.ghannam@amd.com, dave@stgolabs.net,
	metze@samba.org, elver@google.com, ebiederm@xmission.com,
	christophe.leroy@csgroup.eu, linux-kernel@vger.kernel.org,
	Xiongwei Song <sxwjean@gmail.com>
Subject: Re: [PATCH RESEND 2/2] x86/mm: Randomize va with generic arch_pick_mmap_layout()
Date: Wed, 22 Sep 2021 21:28:36 +0800	[thread overview]
Message-ID: <F5C77677-F529-4C77-8155-CE8424F8B16B@me.com> (raw)
In-Reply-To: <YUnvKV0Qf6zhiasz@hirez.programming.kicks-ass.net>


> On Sep 21, 2021, at 10:41 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> 
> On Tue, Sep 21, 2021 at 10:34:14PM +0800, sxwjean@me.com wrote:
>> diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
>> index 7516e4199b3c..c697e377644d 100644
>> --- a/arch/x86/include/asm/compat.h
>> +++ b/arch/x86/include/asm/compat.h
>> @@ -151,6 +151,11 @@ struct compat_shmid64_ds {
>> 	compat_ulong_t __unused5;
>> };
>> 
>> +static inline int is_compat_task(void)
>> +{
>> +	return IS_ENABLED(CONFIG_COMPAT) && test_thread_flag(TIF_32BIT);
>> +}
>> +
> 
> This is still fundamentally broken for x86. x86 doesn't have compat
> tasks, the granularity is at syscall at best.

Hi Peter,

Thank you for pointing this out. I understand now a 64bit task can call a 32bit syscall. 
Here we should use in_compat_syscall() to check if the kernel is in compat mode, right?

Regards,
Xiongwei

  reply	other threads:[~2021-09-22 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 14:34 [PATCH RESEND 0/2] Use generic code for randomization of virtual address of x86 sxwjean
2021-09-21 14:34 ` [PATCH RESEND 1/2] x86: Rename TIF_ADDR32 to TIF_32BIT sxwjean
2021-09-21 14:34 ` [PATCH RESEND 2/2] x86/mm: Randomize va with generic arch_pick_mmap_layout() sxwjean
2021-09-21 14:41   ` Peter Zijlstra
2021-09-22 13:28     ` Xiongwei Song [this message]
2021-09-27  7:37   ` Xiongwei Song
2021-09-27 16:27     ` Kees Cook
2021-09-28  2:14       ` Xiongwei Song

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=F5C77677-F529-4C77-8155-CE8424F8B16B@me.com \
    --to=sxwjean@me.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave@stgolabs.net \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=elver@google.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kim.phillips@amd.com \
    --cc=krisman@collabora.com \
    --cc=laijs@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=metze@samba.org \
    --cc=mingo@redhat.com \
    --cc=nivedita@alum.mit.edu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sblbir@amazon.com \
    --cc=sxwjean@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /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).