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 265FBC433FE for ; Wed, 22 Sep 2021 13:28:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B82861090 for ; Wed, 22 Sep 2021 13:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232029AbhIVNaW (ORCPT ); Wed, 22 Sep 2021 09:30:22 -0400 Received: from pv50p00im-ztdg10021201.me.com ([17.58.6.45]:57883 "EHLO pv50p00im-ztdg10021201.me.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbhIVNaU (ORCPT ); Wed, 22 Sep 2021 09:30:20 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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=