Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 6CE0F3EA8C for ; Wed, 6 Dec 2023 20:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UDamrFEl" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d0538d9bbcso1349165ad.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=lists.linux.dev; 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=UDamrFElWNIFPenywxsq9ZUu9NrBMkqbN4uFybyCjdYClAmFPYIV2OLhqjj+VPuIrS pVkEBa/aM83dOZMgKM6JzmZxB9J4leYscpQZkfRit9L4YkD4UEU3vgKkL+pqjnElr7f9 J4v2RsLXMjGu64+7LvpNMGb8HiVzsmN2WuQ4sc4mrVfoyFhO350HqWT50JbKi/GnIKO8 uCT6rF8PDwJcDRo7iPtE21mM3kB4rCzO09rkG0HiGe6UA+b4KoRTDR27NZLYVAhRsV6x s56mpQOB5Z4BIQrHqCl4uvJP9x3Q+MYIRATpmMq1Mx1j4w10edZmvvPwvaDZo9d0838M nNuA== 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=tvf8hhFeCxV/HLPn+3LAphFItfJqqTh4k7eNuYiFH6jV/uE2gOG3Bo9XUyUv8tV/Gq 1l/ee08lOcVeff4TCrIbtAUA63XZnO8pfhuQuzrtmA0zNRHiACVNJFm603m3tyoP06LV RKmFZuXpbERtum+g54NvnO0Bg6BcuedKr78PZqmU8zPemDGfK7xO3/HLkWqUTJ/9/qEM /3Xe9OReDQZM5VS6xbC2HgHdlHPKGgrMMhNmx+EViVR0nXVN009UHS+BOvTMyAtr6qrS JKhbjhhuaQU8LBPY1TNc2nYFPjNq1oX3f7a1gFHguCHpamZbierwZqbI9cANMDYbKyxc Vp/w== X-Gm-Message-State: AOJu0YxWlLYYGaBV3+J7sYgmuOsuvYBvMJmtHlCNU5m5zp/dK1osMWtN 7FM8m133hT99ufPI40PAXIveKg== X-Google-Smtp-Source: AGHT+IG+PGi/Ruq72+ftbttXAOwy9ae3wKn38k1eINbZqpLAyVIquTjmRIENSAWXjKXoIaCS0/BIwA== 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> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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