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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BEDBC433FE for ; Wed, 16 Nov 2022 10:18:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA65E6B0071; Wed, 16 Nov 2022 05:18:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E572B6B0072; Wed, 16 Nov 2022 05:18:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF9AE8E0001; Wed, 16 Nov 2022 05:18:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BED4D6B0071 for ; Wed, 16 Nov 2022 05:18:55 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8DC6D160378 for ; Wed, 16 Nov 2022 10:18:55 +0000 (UTC) X-FDA: 80138907030.18.4B5DD7B Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf22.hostedemail.com (Postfix) with ESMTP id 17EC0C0006 for ; Wed, 16 Nov 2022 10:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fPq7tV/2QrdcGUCtPsVdOGkEWJNB5jMtOAqK/xzSNP8=; b=mvTcBioZ2ydT6zOL0WsZpRiqLF /wNmPcS0dCzbIc8xSMuf4oMHZxucJGQhaR/T9uhRjFOZCDLwEV0Zuq27CGInXJkU6AWm9+BEcAHwY Z4e0QXqjjJ5nAPfZUU+p4EQna7WqevLJawCiETQtneHLHaIsH5e4Ni83er9A0DqZdmhfCvPgd2c30 SztwgIhn9KcuN7CHQErI6KbJD5wBii8MmqIp8lw30qV3OjCRZHKf+fBlqzkGLde5LQwQA4dIsx4Rt elgCnfTFqNY26L82GW+9Ye5fCTCJHz+MMqlwt99lsBJbOT8AWUEK1nuizoTiWA1hSfnTnZNNw81BQ Dx91JRnA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovFVB-001GgG-63; Wed, 16 Nov 2022 10:18:41 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6A303300129; Wed, 16 Nov 2022 11:18:40 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 50A762B5E019F; Wed, 16 Nov 2022 11:18:40 +0100 (CET) Date: Wed, 16 Nov 2022 11:18:40 +0100 From: Peter Zijlstra To: "Edgecombe, Rick P" Cc: "bsingharora@gmail.com" , "hpa@zytor.com" , "Syromiatnikov, Eugene" , "rdunlap@infradead.org" , "keescook@chromium.org" , "Yu, Yu-cheng" , "dave.hansen@linux.intel.com" , "kirill.shutemov@linux.intel.com" , "Eranian, Stephane" , "linux-mm@kvack.org" , "fweimer@redhat.com" , "nadav.amit@gmail.com" , "jannh@google.com" , "dethoma@microsoft.com" , "kcc@google.com" , "linux-arch@vger.kernel.org" , "bp@alien8.de" , "oleg@redhat.com" , "hjl.tools@gmail.com" , "Yang, Weijiang" , "Lutomirski, Andy" , "pavel@ucw.cz" , "arnd@arndb.de" , "tglx@linutronix.de" , "mike.kravetz@oracle.com" , "x86@kernel.org" , "linux-doc@vger.kernel.org" , "jamorris@linux.microsoft.com" , "john.allen@amd.com" , "rppt@kernel.org" , "mingo@redhat.com" , "Shankar, Ravi V" , "corbet@lwn.net" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "gorcunov@gmail.com" , "akpm@linux-foundation.org" Subject: Re: [PATCH v3 27/37] x86/shstk: Introduce routines modifying shstk Message-ID: References: <20221104223604.29615-1-rick.p.edgecombe@intel.com> <20221104223604.29615-28-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668593935; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fPq7tV/2QrdcGUCtPsVdOGkEWJNB5jMtOAqK/xzSNP8=; b=upDxxtlrk0yt7Fr8SfxojdwnlqOsCTFJ3OOO2KHaHvamzs3UBZzGVGi3XIwoUO088krv13 UFhYclBM0wqRyrwsK7OhUBQjV+BT8rkw088KCflw/NgzV+e84EUoRKH990TYwlqXugUHT0 3H+r4XFR7wlxXtVmmWX6w9TLqns6YcM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=mvTcBioZ; dmarc=none; spf=none (imf22.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668593935; a=rsa-sha256; cv=none; b=hiwjF7hH5gzKU0CYW/Amnjbyqge2gpEzSfe3GlpCRPPq+7bFkqVmim6Ekq2ln3NKeQNd7E BwLItTRRbNfLW3S2xjyTZIU3a7fLsRhVF6yvbj8sCZKIplx55m6X0X9Gtkcdph8w/jXlFn 7M9N0f8tHTg2ReyMR5SteHn/cy61JvA= X-Rspam-User: X-Stat-Signature: ozknret1fzaantjfeanbzq95z4rr4bzf X-Rspamd-Queue-Id: 17EC0C0006 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=mvTcBioZ; dmarc=none; spf=none (imf22.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org X-Rspamd-Server: rspam07 X-HE-Tag: 1668593934-93708 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 Tue, Nov 15, 2022 at 11:42:46PM +0000, Edgecombe, Rick P wrote: > On Tue, 2022-11-15 at 15:18 +0100, Peter Zijlstra wrote: > > On Fri, Nov 04, 2022 at 03:35:54PM -0700, Rick Edgecombe wrote: > > > > > +#ifdef CONFIG_X86_USER_SHADOW_STACK > > > +static inline int write_user_shstk_64(u64 __user *addr, u64 val) > > > +{ > > > + asm_volatile_goto("1: wrussq %[val], (%[addr])\n" > > > + _ASM_EXTABLE(1b, %l[fail]) > > > + :: [addr] "r" (addr), [val] "r" (val) > > > + :: fail); > > > + return 0; > > > +fail: > > > + return -EFAULT; > > > +} > > > +#endif /* CONFIG_X86_USER_SHADOW_STACK */ > > > > Why isn't this modelled after put_user() ? > > You mean as far as supporting multiple sizes? It just isn't really > needed yet. We are only writing single frames. I suppose it might make > more sense with the alt shadow stack support, but that is dropped for > now. > > The other difference here is that WRUSS is a weird instruction that is > treated as a user access even if it comes from the kernel mode. So it's > doesn't need to stac/clac. > > > > > Should you write a 64bit value even if the task receiving a signal is > > 32bit ? > > 32 bit support was also dropped. How? Task could start life as 64bit, frob LDT to set up 32bit code segment and jump into it and start doing 32bit syscalls, then what? AFAICT those 32bit syscalls will end up doing SA_IA32_ABI sigframes.