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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2D4C4708E for ; Sat, 3 Dec 2022 02:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235152AbiLCCn1 (ORCPT ); Fri, 2 Dec 2022 21:43:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234309AbiLCCn0 (ORCPT ); Fri, 2 Dec 2022 21:43:26 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EB22CE36 for ; Fri, 2 Dec 2022 18:43:25 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id n3so2285645pfq.10 for ; Fri, 02 Dec 2022 18:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=X/PM/ivVkW0jUG/czVpW7oWD1ho2PznSORqfUymBhy0=; b=BHC6VeRwJG5T8EtepfIwQCAz4f9/KMXxVhufdafNbwx34sQ2cfpog8dPrmfZytxgHw NwiHwbtRX1tNbYxQIDHSiKl/7Lb7dxQ25uXaOLiSD58djV8k9k9R7+J6HxJOnapfIbj+ ZhXmuaM7yhrvC8Agryx8O++LaWvytYXU7+iAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=X/PM/ivVkW0jUG/czVpW7oWD1ho2PznSORqfUymBhy0=; b=QqJib+ImSG47rwje5kigjWpp5U1lgwdf8Bss3pu0ANq7XR9Da6nUiISr1yxuvY4crV iiGAgCoQr3OREH/WK7/iD2WSw66Z3d/M94C0RUrmDvVxGYmWw8EHOCYPKMmd6e3Mb4hT 0uQtAj/Wy3aOloA98OBWfGl5jphOuhtO1AiA/5E+2NPSjT/7jOMrPaCZh1LFJkSsPEjk A4XLRcf0iC0OhLarexu3K7ZYXachJ2Oc5oHnxA4c8EqGsX4nKcEmXRPfftQ4rUmwGSAk c7GO8Ur9itmfh4JBNq6omgAnV6qfdEbZvBus7MIo/ARe8vk2Na4uQWI6k8iG+LANRZnD gT+w== X-Gm-Message-State: ANoB5pmArTrXBz2sCo1FIBiloTEzZj4YMDBRc/T2Cn5qsKuupOSRS86W lE/u5IC/4U/qwUuyrWHjIU8C/Q== X-Google-Smtp-Source: AA0mqf67lnVWRQXMh/AnnxK9m37yXIew2nPrJP0zGiZF9Jg3GWVCVk2zapCjUdbyQSdpkIJPLM0Djg== X-Received: by 2002:a65:560a:0:b0:477:382d:dd38 with SMTP id l10-20020a65560a000000b00477382ddd38mr47494099pgs.264.1670035405043; Fri, 02 Dec 2022 18:43:25 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q24-20020aa78438000000b00576984617b1sm269014pfn.60.2022.12.02.18.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 18:43:24 -0800 (PST) Date: Fri, 2 Dec 2022 18:43:23 -0800 From: Kees Cook To: Rick Edgecombe Cc: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , Weijiang Yang , "Kirill A . Shutemov" , John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com, Yu-cheng Yu Subject: Re: [PATCH v4 26/39] x86/shstk: Add user-mode shadow stack support Message-ID: <202212021843.89B0A2DBE1@keescook> References: <20221203003606.6838-1-rick.p.edgecombe@intel.com> <20221203003606.6838-27-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221203003606.6838-27-rick.p.edgecombe@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Fri, Dec 02, 2022 at 04:35:53PM -0800, Rick Edgecombe wrote: > From: Yu-cheng Yu > > Introduce basic shadow stack enabling/disabling/allocation routines. > A task's shadow stack is allocated from memory with VM_SHADOW_STACK flag > and has a fixed size of min(RLIMIT_STACK, 4GB). > > Keep the task's shadow stack address and size in thread_struct. This will > be copied when cloning new threads, but needs to be cleared during exec, > so add a function to do this. > > Do not support IA32 emulation or x32. > > Tested-by: Pengfei Xu > Tested-by: John Allen > Signed-off-by: Yu-cheng Yu Reviewed-by: Kees Cook -- Kees Cook