Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1234671rdb; Wed, 6 Dec 2023 12:23:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFi/qwg33QFEbRvD4zFClCuWOZpfneAMkdqmV3txuv1TEtfAQMJuEkUmYdopl7gfDSgFZ/R X-Received: by 2002:a05:6a20:7da9:b0:18f:97c:8a15 with SMTP id v41-20020a056a207da900b0018f097c8a15mr1626547pzj.64.1701894184830; Wed, 06 Dec 2023 12:23:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701894184; cv=none; d=google.com; s=arc-20160816; b=kPRxnm0gYrmFWILK6fpoZLZcUSSKNRJIn4Sf1OE0fCETC7Q1NHomY48tph7xn/+fpR /WVI4wpLWidqJ3JJA9ZNLwB3RhMduvNKPBrxjDhmX4/RGXlleei/bP+wvYNeLAP1scST U7BLqfbKSVuQH0SGf+gJCM/MUlTMCECUAt1bxgIP5hlqnvgsEjHx5Pv5UHZp19SdHrws 7dgkRJaqIjylNLv6ZnX5WlULA8bfFBMx0D0qJCmLjl6nz84ZZDh1WkNWHc/P2EPaLW4l YOjsqJxPlY/jvbghzeegfKkNcloTQV1Ed+3XTMZeKcyxC5OMftnaH+9xJkANIDarDbw/ cQDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:user-agent:references:dkim-signature; bh=wEKgHh9Vd3x1VnCH3fKyTqAO4yCFQDcZVScsz606mCI=; fh=2nPFT/KTslTQ686WgFSojEEZau7G7tqoQ5Zr2uSyW1U=; b=sKbROIBmL0Mmw/9knTJYCB/33NhRPHhrKRp81Obs7LMTBDQZI1BWwKNsvlxHA3cOKK ML26ebAnSzXgrqWyLWaqvSFzbhqi1xmSLz6YwYH+zWwWuC1n0yJLvlTcpSruIkLqYUQi 8KZTo3rMV5a7DWNxLJStmOVJWL8pmz+KoLqOn39csgynUxNCVlZgn8ciMkRyhsSeQjSZ UzvCpv6a64gcWOz3uKQKmQ43uUMeOessA6XFto1glXzwr2KwHpQKg0iIPJR9upYp2lvd ubb581ds7uSiB6Co3334I9JAtFBGPFeGu+X8RDKBlY6zl5NGBaY7OcYrxNH5dZ+E/INn u0Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PVn50Q4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 19-20020a631553000000b005c6183ccab1si405404pgv.529.2023.12.06.12.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:23:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PVn50Q4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AD2E280E9E22; Wed, 6 Dec 2023 12:23:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442897AbjLFUWs (ORCPT + 99 others); Wed, 6 Dec 2023 15:22:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379532AbjLFUWq (ORCPT ); Wed, 6 Dec 2023 15:22:46 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B68BD66 for ; Wed, 6 Dec 2023 12:22:52 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d0538d9bbcso1349185ad.3 for ; Wed, 06 Dec 2023 12:22:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701894172; x=1702498972; darn=vger.kernel.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=wEKgHh9Vd3x1VnCH3fKyTqAO4yCFQDcZVScsz606mCI=; b=PVn50Q4RLuzMR14j+U6APgpOl2LYdffAuu+oeSRN0D/cWGpiAcHNPva2TRKwQUqIk+ v8ORKAOfxQxnGFBxZCn7bPwqMBjCkNtHMGbcS0jEW08ItZonzA9v4FJP2rjEsCeNtWxT 4p9WCxws66nAVAlPjIxp6hxAKJuGXia1NgwMFrasXuW3zz7yPF2sN9krvj+ruchKrVjM i95eq/DPs97H1ROevLCgRL99MvLLL+jl1pzVnKadI0Fn2oKggKC9aurPt3iMvwXwUpQD V6RNQFqiwu0bL0OPMslIdDoczVs07ppstSXEpmCSmHwqQIkxWU3ZjpXU6dvJhCvwHJIW W23g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701894172; x=1702498972; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wEKgHh9Vd3x1VnCH3fKyTqAO4yCFQDcZVScsz606mCI=; b=R1mg1VnBmSHcsz9eqiNywNlOaEOg6UkIkByXcRpoE9gpwpFm8mgDGTeOBIYKV+nkME sPxGOywPTuJKeFvzVlfyRHM6Ga5C6Cvho5ntUyYLNq6kBG5Vw4rOmnkTZ7cOAkU+O8yg //TCyzhbFiG+X7QEHJIZujLd/CyLV/OE1Tvmh9BMFkPdQM5QWto2sQ7Z4qBLrPJNc6ij MtxyBNKu622bmTYn5sFEm9RYelE7KPp3S875DwawoeXOOjsEVgWWEvvdpwhYomXv4YOK AdDg+qCMPppuOkeRKuSJKC1ny3qqNOgTbsNcaEh1go8SwiofB0iQm8kuBanxY+vfM/fp VuHg== X-Gm-Message-State: AOJu0YwHUKpkNOzsJlnLTiXjhSjvO1tZpCNWbvckfjG/8GWT2/VhTm+o 31BXJU8UseuLlV23aD9xqf88SQ== X-Received: by 2002:a17:902:d502:b0:1d0:92a0:492b with SMTP id b2-20020a170902d50200b001d092a0492bmr1505448plg.84.1701894171625; Wed, 06 Dec 2023 12:22:51 -0800 (PST) Received: from localhost ([2804:14d:7e22:803e:f0e2:3ff1:8acc:a2d5]) by smtp.gmail.com with ESMTPSA id z2-20020a170902ee0200b001d071a305ecsm217078plb.245.2023.12.06.12.22.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:22:51 -0800 (PST) References: <20231122-arm64-gcs-v7-0-201c483bd775@kernel.org> <20231122-arm64-gcs-v7-21-201c483bd775@kernel.org> User-agent: mu4e 1.10.8; emacs 29.1 From: Thiago Jung Bauermann To: Mark Brown Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v7 21/39] arm64/gcs: Allocate a new GCS for threads with GCS enabled In-reply-to: <20231122-arm64-gcs-v7-21-201c483bd775@kernel.org> Date: Wed, 06 Dec 2023 17:22:49 -0300 Message-ID: <87il5bhyhy.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 06 Dec 2023 12:23:01 -0800 (PST) Mark Brown writes: > When a new thread is created by a thread with GCS enabled the GCS needs > to be specified along with the regular stack. clone3() has been > extended to support this case, allowing userspace to explicitly request > the size for the GCS to be created, but plain clone() is not extensible > and existing clone3() users will not specify a size. > > For compatibility with these cases and also x86 (which did not initially > implement clone3() support for shadow stacks) if no GCS is specified we > will allocate one thread so when a thread is created which has GCS ~~~~~~ This "thread" seems extraneous in the sentence. Remove it? > enabled allocate one for it. We follow the extensively discussed x86 > implementation and allocate min(RLIMIT_STACK, 4G). Since the GCS only Isn't it min(RLIMIT_STACK/2, 2G)? > stores the call stack and not any variables this should be more than > sufficient for most applications. > > GCSs allocated via this mechanism then it will be freed when the thread > exits. I'm not sure I parsed this sentence correctly. Is it missing an "If" at the beginning? -- Thiago