From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40704C433EF for ; Wed, 22 Sep 2021 13:28:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C03A8611C6 for ; Wed, 22 Sep 2021 13:28:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C03A8611C6 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=me.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1F28B6B006C; Wed, 22 Sep 2021 09:28:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A27E900002; Wed, 22 Sep 2021 09:28:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06A856B0073; Wed, 22 Sep 2021 09:28:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id E6EF36B006C for ; Wed, 22 Sep 2021 09:28:52 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 870EC2D4DF for ; Wed, 22 Sep 2021 13:28:52 +0000 (UTC) X-FDA: 78615289704.05.3C1EAED Received: from pv50p00im-ztdg10021201.me.com (pv50p00im-ztdg10021201.me.com [17.58.6.45]) by imf10.hostedemail.com (Postfix) with ESMTP id 1208A6001983 for ; Wed, 22 Sep 2021 13:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1632317330; bh=RodfW4bUHt8EGYhK9AjVjeL8HXHZ0mndLyop4t9ZHFI=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To; b=oYBEnpJ4qpnibOMIW1R8++ExPPZau1G3C/caQu53DxW4iJDacHwLI9ixro1NtFKsS pDUO358tRLsmQrFM48D6JJCQ2TdA49UhD7qIggzGyU/9nq1k4xJ0YfaG1zEQR+4km/ mttWL52IzGp+9Czw22C8mwA0rCBfTFSCE/IJadJ6Hs699Si1TuIJCGb5YDxm8mf3WE 5X7caqvQDAewv6ZGjXFi6typUZnrc7jpduNfEbfqntm1mLSfOx5whzEMLwUkjYYngM Sa2DKQZTenYy2VTDpHBCSc90mRBCVj+Btxi631PokxxbHOQIAMzTRX11aam3aIwctK cw4Ns9f88LyqQ== Received: from 192.168.1.9 (unknown [120.245.3.47]) by pv50p00im-ztdg10021201.me.com (Postfix) with ESMTPSA id 5D00DA401D7; Wed, 22 Sep 2021 13:28:40 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: [PATCH RESEND 2/2] x86/mm: Randomize va with generic arch_pick_mmap_layout() From: Xiongwei Song In-Reply-To: Date: Wed, 22 Sep 2021 21:28:36 +0800 Cc: x86@kernel.org, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Gabriel Krisman Bertazi , "Chang S. Bae" , Al Viro , Arvind Sankar , 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 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20210921143414.70723-1-sxwjean@me.com> <20210921143414.70723-3-sxwjean@me.com> To: Peter Zijlstra X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-22_05:2021-09-22,2021-09-22 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=872 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2009150000 definitions=main-2109220096 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=me.com header.s=1a1hai header.b=oYBEnpJ4; spf=pass (imf10.hostedemail.com: domain of sxwjean@me.com designates 17.58.6.45 as permitted sender) smtp.mailfrom=sxwjean@me.com; dmarc=pass (policy=quarantine) header.from=me.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1208A6001983 X-Stat-Signature: sbeoqagqy6m58z1fi5tckpruks6f4ixe X-HE-Tag: 1632317331-188863 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > On Sep 21, 2021, at 10:41 PM, Peter Zijlstra = wrote: >=20 > 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; >> }; >>=20 >> +static inline int is_compat_task(void) >> +{ >> + return IS_ENABLED(CONFIG_COMPAT) && test_thread_flag(TIF_32BIT); >> +} >> + >=20 > 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.=20 Here we should use in_compat_syscall() to check if the kernel is in = compat mode, right? Regards, Xiongwei=