Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp327189lqp; Thu, 4 Apr 2024 14:39:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1kCZHX0VtltG7rJfGaGtzui/GqwNWjHYvaD4QfZkZhj6absCbX7MvxXIhFfGBfTSXVyTGfd4FbQV9WJDLJqdEPKuX4dHvlqrSaanjKw== X-Google-Smtp-Source: AGHT+IFpJi7YfFd1uns/ZLWpHgpnXcMZWnwiPon98NILLDRIZ+l54I/5hZJozudXVnB6TxQhY5CC X-Received: by 2002:a17:906:2dc8:b0:a4d:fb90:4a4e with SMTP id h8-20020a1709062dc800b00a4dfb904a4emr575098eji.2.1712266777095; Thu, 04 Apr 2024 14:39:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712266777; cv=pass; d=google.com; s=arc-20160816; b=j45BxQqTNgQVNF9kwf/1eeVrt8ZJkNCT4fQnzqefkRuFcwGnMJCkylJkcDor6s2iTb BJFFUvxnS8uoZXv5j1SWmDFShkh4zG3t1P4LDFuG3wrvi2EG80/ddLVDjEOXNyHxlNlc LSpAUHF9rQYmFHWQLDXug8E/rPHMBCpsB4aM1OHrusYEE1ZoQTChy//K+Jf3YqNNztmw 5rogE2VJel8wRWJhU8vhXFGrbFm4W7TCw/Z3C3wlbw4xNeDLCVt78iuebVkFO2cGfms2 AviOY7ce7d8Ib0u/9ur+JLjrkLhpfkNcQ5Ihiy5JcJrp3lBoTpt4g2vx0SjopzkeK98T btkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fPArP3ejLo3l+aX8ToKGJxurh8OEHx4iQxc5XkqOF4g=; fh=kDuhNA7P2N1o4j0n8lo/99boixWL64QJKc6SqB8VytU=; b=g28RbaopOZOMV1mDUlX/0s0CXT3oKIPKHSpQA8VbqFNeTBdq3a/wz0wgOflAYdtdYI KfMCi1gLMbnI2fj2biIqF4ad16xYdSrzuXboo+Z/kIjusKz2LJsPuEbCVC6JnNngBOn2 s5ynqN7sISaiX85jxiafnxIMK2IVX1s3eTG7/E9cyp4S9eQAVTP39j/1vLRjiWzgTn1L 9yjBm2dJibSAbdBeARL1uUMM98yh/qQhkSNFrvETyg3xF/4Yh0udHVfBzay5n67IX6ao dERkJN5AmEqwXQPpD04iYDWcMyb+kq/6n7YZxJkupUTKwAopT1NUXiiodGwwwa6K5GTX Y4Vg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=XK1jAX6K; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-132168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132168-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o23-20020a1709062e9700b00a471b4c7f8dsi47365eji.9.2024.04.04.14.39.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 14:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=XK1jAX6K; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-132168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132168-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CC70C1F21298 for ; Thu, 4 Apr 2024 21:39:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BE2913C3D1; Thu, 4 Apr 2024 21:39:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="XK1jAX6K" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD65313BC04 for ; Thu, 4 Apr 2024 21:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712266766; cv=none; b=TEm8emXGJmMW5oGQlPvShWl02uHIiA6fO2X2maMe3N9e3CT3D4jocOvL6ifWghQbT5ZIkbsJbx5OXnCcOXzpPHfdeW/cSQI5llATPxlHrdQpTljdbxJtKTPT5RqRNLxYAlzGUeJGusPWwp1DfyXWaIWFPP4jAQVbGZzMFJGCODA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712266766; c=relaxed/simple; bh=Zt3p9tm6ccxc55MDuLlmUGMbvykDWgHwcdcfZ9QX5/k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PJHAvQAJFeEdyv1IpIofvNOGV3lVvIdVe6Yco0Ge0gETEiCUrNqDV5bFo3OHebpOu/V3P+rHsXS/+xnHRC+zQHXDWrAoFqn2/3TariDw1lMSitN/Wi4JVFPgdcYCDFfr1N1c307adghNN81QjVj7SlzmMxHeWDGJ5smZlVF996g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=XK1jAX6K; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1e220e40998so11149565ad.1 for ; Thu, 04 Apr 2024 14:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712266764; x=1712871564; darn=vger.kernel.org; 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=fPArP3ejLo3l+aX8ToKGJxurh8OEHx4iQxc5XkqOF4g=; b=XK1jAX6K8VflAzuRMINM++28+YHBOii5vu8nrxPFZ3gyFsnviquih7GU0vTtK6FX+2 1sGWaS2U8myytUsmi7UmwKxVQQGZl+vWd6wrkz2OA2mLNKomKepdIhp8jk9h0ZSQ76XV 5MeG/9wWhrDQ1qlxAGKRtmV/SGtznnQbJsMjxbwH4YheOtY3pq02RKu82sgXTnpMCy+R JQ+mvfq2QOaE8zwWRXGBgTQ7wjESzbqnc888VZq/cVJTO3vtU662o00QO+lYpiQC6i/1 6irOXT1XRWWzOSKw3WpArC5/sQTCltw++pzk8kcPHQC/9dH46cmh4fgwxbx5ng5n4VQa UBlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712266764; x=1712871564; 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=fPArP3ejLo3l+aX8ToKGJxurh8OEHx4iQxc5XkqOF4g=; b=IRMOh00dc3UYf+4Mk8/MUElWbislRVdxdNbfMKXFja4cAsT7CvSJxoROVidM1RIWqd nbzTItn97hHpwn54yS3eGrJl+6Y+mhPL/g3x2O9mm1J3wX8AaSiE3LFAseuxI6ebBpc4 NrQkGS6YTVuBYm+2tprOEjAqRJxSRjlZ0RwbaIMrSQ+Yn8pPrzac4QWhY0RPyeJhEzAW hGeDlgh3NHEjoUDXfGUIYmXOrQGiRPvvosnvvCbQ8afOrHujb9GHGS5pUxLsTnkhznwn N9anH64WRNa3Auz+ESOykiuRTWgztw6lCJOKPXMbPJ4TAgl71evadmGcpcW50LZDlHRR MSTw== X-Forwarded-Encrypted: i=1; AJvYcCWV4pjz7+QUpLLvHtrfyVPqdR+IQwzAMiEGNS5zAbXqD+lc/e01zd1+x06OahHEEpM64OqX7sGvNTDmqWM3JdtLTm+rx8topwOZJra+ X-Gm-Message-State: AOJu0YzXRYE1Ckq4hoyPucPrU5Cy54JLPG9a3+573BS5VrFNpKGVH9FU +G+6hrXj+Bx44VvAr1VbcPceVsKyA2UOtDCtL9AZC4r+p4eP4nqKhmZopIemCnc= X-Received: by 2002:a17:902:f68a:b0:1e2:887a:68a7 with SMTP id l10-20020a170902f68a00b001e2887a68a7mr4103646plg.33.1712266763893; Thu, 04 Apr 2024 14:39:23 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id l10-20020a170903244a00b001e29833ada6sm89367pls.140.2024.04.04.14.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 14:39:23 -0700 (PDT) Date: Thu, 4 Apr 2024 14:39:20 -0700 From: Deepak Gupta To: David Hildenbrand Cc: paul.walmsley@sifive.com, rick.p.edgecombe@intel.com, broonie@kernel.org, Szabolcs.Nagy@arm.com, kito.cheng@sifive.com, keescook@chromium.org, ajones@ventanamicro.com, conor.dooley@microchip.com, cleger@rivosinc.com, atishp@atishpatra.org, alex@ghiti.fr, bjorn@rivosinc.com, alexghiti@rivosinc.com, samuel.holland@sifive.com, conor@kernel.org, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, corbet@lwn.net, palmer@dabbelt.com, aou@eecs.berkeley.edu, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, oleg@redhat.com, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, Liam.Howlett@oracle.com, vbabka@suse.cz, lstoakes@gmail.com, shuah@kernel.org, brauner@kernel.org, andy.chiu@sifive.com, jerry.shih@sifive.com, hankuan.chen@sifive.com, greentime.hu@sifive.com, evan@rivosinc.com, xiao.w.wang@intel.com, charlie@rivosinc.com, apatel@ventanamicro.com, mchitale@ventanamicro.com, dbarboza@ventanamicro.com, sameo@rivosinc.com, shikemeng@huaweicloud.com, willy@infradead.org, vincent.chen@sifive.com, guoren@kernel.org, samitolvanen@google.com, songshuaishuai@tinylab.org, gerg@kernel.org, heiko@sntech.de, bhe@redhat.com, jeeheng.sia@starfivetech.com, cyy@cyyself.name, maskray@google.com, ancientmodern4@gmail.com, mathis.salmen@matsal.de, cuiyunhui@bytedance.com, bgray@linux.ibm.com, mpe@ellerman.id.au, baruch@tkos.co.il, alx@kernel.org, catalin.marinas@arm.com, revest@chromium.org, josh@joshtriplett.org, shr@devkernel.io, deller@gmx.de, omosnace@redhat.com, ojeda@kernel.org, jhubbard@nvidia.com, Mike Rapoport Subject: Re: [PATCH v3 09/29] mm: abstract shadow stack vma behind `vma_is_shadow_stack` Message-ID: References: <20240403234054.2020347-1-debug@rivosinc.com> <20240403234054.2020347-10-debug@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: On Thu, Apr 04, 2024 at 09:02:17PM +0200, David Hildenbrand wrote: >On 04.04.24 01:34, Deepak Gupta wrote: >> } >>- } else if (!(vm_flags & VM_READ)) { >>+ } else if (!(vm_flags & VM_READ) && !vma_is_shadow_stack(vm_flags)) { >>+ /* reads allowed if its shadow stack vma */ >> if (!(gup_flags & FOLL_FORCE)) >> return -EFAULT; >> /* > >Unless I am missing something, this is not a simple cleanup. It should >go into a separate patch with a clearly documented reason for that >change. I tried that here https://lore.kernel.org/linux-mm/CAKC1njTPBqtsAOn-CWhB+-8FaZ2KWkkz-vRZr7MZq=0yLUdjcQ@mail.gmail.com/T/ But at that time, VM_SHADOW_STACK for riscv meant only VM_WRITE. So I think there was obvious uneasiness with that part. Now we have VM_SHADOW_STACK pretty much same for all arches and only 64bit. I'll try it again as a separate patch. > >-- >Cheers, > >David / dhildenb >