Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2935485rdb; Sat, 9 Dec 2023 05:10:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+a648cNSmzOtD+2FQLD6D+Vnch0XDkLSucK4N5hmbKn0g1EYmYqcOKb1vH2Brlw6b7uad X-Received: by 2002:a17:90a:94c7:b0:286:7f04:23c0 with SMTP id j7-20020a17090a94c700b002867f0423c0mr1197766pjw.4.1702127403223; Sat, 09 Dec 2023 05:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702127403; cv=none; d=google.com; s=arc-20160816; b=r9sVPKY3vysbNb3kpw6uFQjIcBwSuFjs1CFT+LagkLP6Mwak8c3XkhBe3FnXuP96WC muAppjXPDuOlsGnS75DdxZDbNJqOphBEwjPrDDlcy12i4SX26iWUkEw3PvtzeYw/IK/8 f1hJOJyLZxyRAZ4KqqonmMLP/XSBm0rCeoHvNqpOb8jA/84Qk6z23FzPqGizexGJJbgL K8pZe64Vj/G2wP7Nq4r9rjSrA+WMBwn81xl5nkGy4LAH9NIbV+QiBuG+Wm5dJejsYZvg +y3nBGtCSj1hBKpXNo+geNMfuK028c1NQMtlF+HjX5hRs5UAx4YKJZWdXXPaceEcv+k4 IxXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lv2iEl8vE5wkVhjmXXlndj/DW6vmd2p76HKR534m3EA=; fh=2cOLKalsvJWgp6X/iQQOoa8XWKauU+XcecEfmW3UZwY=; b=lXMdM0hOgKsMT449ggtMgOrz8C60yiHa09w4bKNPernWL65aEJXGqyC455wgUd78Of 1i3o52Z9qf4LI4H3QhoDxB0UYT4BWsJSal+6HWOvyJQUNVTCwo7q8lxBsFCGPLQ4ftrt Z2J79p3XBXP7WKfhhoHWMV0pLU8v0Ed7+2EQpusv4OuBL0b7LXOfYG3/ANvzOuThDGI/ o9zpsCYw61hEb6h+C3058fOzzwiApEDcySdn+WF4KQ1aaqFCR90IStQxXMn3ccwpI1ev RVyy/zd7du/7NK0hEge9UOw5gCDEJ2zwt70i2yvOkxUaGT5kcokywnDXXziriotblCcO 7aJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S6jE7XNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q16-20020a17090aa01000b002868d3e1ab4si3121404pjp.170.2023.12.09.05.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 05:10:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S6jE7XNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8B0B2808D2BB; Sat, 9 Dec 2023 05:09:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbjLINJn (ORCPT + 99 others); Sat, 9 Dec 2023 08:09:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjLINJm (ORCPT ); Sat, 9 Dec 2023 08:09:42 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81E9BAC for ; Sat, 9 Dec 2023 05:09:49 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 783C1C433C8; Sat, 9 Dec 2023 13:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702127389; bh=BXmvRrbuQ7Zo9bps7+7CLsTiu05XaN6dU9PEwdxs+ro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=S6jE7XNTUdBp/jI1nNZw36YjJLxRXIwjeEtof8D9IiRzLKGfNItYmAr+VT2iAQ38c 38YNmmUUIYntBWbwZ9cGSSxaGQim7h9NbXYE8xNDouYR8+TMgLcesHT+cipBw2tgX/ 4lThPROQalN7MagIZParOBO4e1O2Pg4g6V0ixyjV2R33hTQ+sgi2mNYzJWJbwJzmJw rUnZe+RUTAfAHW4aOwHkof8lj7+6t1uk4lf7Y6WTHOwc+fOGo2/av3fMhf6zCZfn9v KMPF5McGv4f6VX8d9RocfRsJKSW7FslB0ZP2s+OE7BGvUVe1zwkJUq28+7u8No8Z/8 zs4EO1JDtaj9w== Date: Sat, 9 Dec 2023 13:09:45 +0000 From: Mark Brown To: Thiago Jung Bauermann 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 24/39] arm64/signal: Set up and restore the GCS context for signal handlers Message-ID: References: <20231122-arm64-gcs-v7-0-201c483bd775@kernel.org> <20231122-arm64-gcs-v7-24-201c483bd775@kernel.org> <8734wcgj79.fsf@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="37w+xraunaVzWRvI" Content-Disposition: inline In-Reply-To: <8734wcgj79.fsf@linaro.org> X-Cookie: You might have mail. X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 groat.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 (groat.vger.email [0.0.0.0]); Sat, 09 Dec 2023 05:09:59 -0800 (PST) --37w+xraunaVzWRvI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Dec 09, 2023 at 12:15:22AM -0300, Thiago Jung Bauermann wrote: > Mark Brown writes: > > + /* The cap must have the low bits set to a token value */ > > + if (GCS_CAP_TOKEN(val) != 0) > > + return false; > I found the comment above a little confusing, since the if condition > actually checks that low bits aren't set at all. Perhaps reword to > something like "The token value of a signal cap must be 0"? Right, that's bitrot from the previous token format. > I'm still not proficient enough in GCS to know how exactly this could be > abused (e.g., somehow writing the desired return location right above > one of these inactive caps and arranging for GCSPR to point to the cap > before returning from a signal) but to be safe or paranoid, perhaps zero > the location of the cap before returning? Right, ideally we'd be doing a compare and exchange here to substitute in a zero. --37w+xraunaVzWRvI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmV0ZxYACgkQJNaLcl1U h9AoDgf/VkzebhdvDSlUlS84JXdoOeqvCdQEoqmGKLcuFu0afYS5oNsgjYoWfoXD aoXaZBnOjvf3Wmp5hO2MtDSGOlnNYMS9btFUd+2docNaeKRynVrPd2hEwST4I/yq ZeT2mGf5o2wyv6qxW6RsXkgz4UUscznq2pitjl0x4ca+pOIeX+qxPQjayUJhPGtL Us1MullRxipMfAZE5H9eGQ5UrEO940lmaqa3GOexHuqAmzs/znZexqoZYXOStiBS DTmANL89uVAgAarTtMNsXKkO8mOZ8D9pNtu+zPEO0JNSrVzQgDD363lTYbIjKz5P QroAHMW7izjjkY7CBtP6RwOmok0Uvw== =u7l1 -----END PGP SIGNATURE----- --37w+xraunaVzWRvI--