Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1109222lqt; Fri, 7 Jun 2024 08:13:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSOBlvYGTDrq7HVB0zaL6s3LZ0BkqfQ/QP3d2tzf7bIRtkegdgG4el6UMxunIlmLCaR1Xc95zPfPm5d/VhSyE9bLKOLn8ByPIJZwMXsQ== X-Google-Smtp-Source: AGHT+IHG96AfoqQnqRin5wn7OM2jNfmapuTM3RvenciDseQ5kUPcNAX8FPJNxRy4ObFF/AM7N0kj X-Received: by 2002:a05:6808:2207:b0:3c9:691e:1e60 with SMTP id 5614622812f47-3d210d8b0b8mr3317990b6e.31.1717773229630; Fri, 07 Jun 2024 08:13:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717773229; cv=pass; d=google.com; s=arc-20160816; b=Pf7qlb6kNXvnumQdqfnC619vKjfXdfV+hDTRZmx8GAKADQR6O/vF9RqkNcxJs2gPv8 GDrOO94gPjfapNQKWQ1+/kgTVqVz4d/7xGwJ3cBrCazh0AAVC44D5z25jDcyjo8ZlJ28 +i6kYGYel+IyKf/Ee/fQbxKpb9uDfVlxCOD8zWsUwyVks7Q9dhYSlwwxPttm/9u2FymF eV+1wIZlqXbqvlpUibSYvlnB6GvKoZGm+WeelkCLvDB1c4Ob3WC5vJ5z9+2pn/xYBdZE lfLxoOnq2cCbI5DtoCNVHvGnTn1qdHpkyn6/LFUAEj1lnx6+diTy3APwcayxt1TTP7Ce UzHw== 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; bh=3VmVw6UZKLqPJeh78KLom6X2U3C8ZlPj9t8u7B+DGYY=; fh=/+ngs7ScuS9F7OQ7k+tp9edbqHXbaKw0PqYjjFAD9Ic=; b=BKcrP5MDjqGmNmEKGGtaEqxDZwzGINFxKk25J+X5XfQ6WIyEjLqUj7OKDpHtvkD4ZD /Pwx4wsmcEoOiinynFKwsRM8q/KUl6ZlIZVuYLg92Azfr7L1bS3nI6cTqZfBvSVHV7de mVJSm1ML+aL2YZ3LSyiK+QiZXIK7MvcVFsUEE2gQwhJuP8vwf1AiRvEggZCIyUCNvY6K v52Jhemkgw13yvI7E+af5wBI79WL10ZmQE4F/kOYN1kGfmtCPvcwZMLj8m/5iApkPnDf ElhRpvpJZeDHPprfIkT+KB97JqWhdzbzD2EH+p8K/rDXWv+Xnqb0+NBBBJkFASjuRNPd oueg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-206356-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a1e0cc1a2514c-80b5eb49e76si831936241.193.2024.06.07.08.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 08:13:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206356-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-206356-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D2DE31C20D51 for ; Fri, 7 Jun 2024 15:12:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64FFC194121; Fri, 7 Jun 2024 15:12:49 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D441825740; Fri, 7 Jun 2024 15:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717773168; cv=none; b=emYSv6F/OLdBQui1NKGdl7mvvoFO8on3QseSDszFSBgyZG8jRV3tk3TrTlzcoLhPCNCBTznYYp9TpQJxM2qNsvg5iX8zxZ4yC+q88qFphZQn7T6Ax37RkgVBZtTp58qqYpW5fASYxYAsKq85IYM34A82CmaEg5TSijEOS7OCaRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717773168; c=relaxed/simple; bh=cAI7qnCyUWL53klNBARNIYIAmGI2f8rwVGyKdWH1ehE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nqApd+zv50x0SsgwQAk3HjCHt9IRFEM0AoaylidxJbHXoUy2k2LQEN5oZ342Hh0oF3orXbRBXdncbQuhu3xhW2BWaIZD+6dfwkV3acZBl1ealmsLnzyjBPIrYvHZAJ85NCMiwiol6UpyypXIaWdB7WnqY1hPLkoIUqwm8V9v4nk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37809C2BBFC; Fri, 7 Jun 2024 15:12:45 +0000 (UTC) Date: Fri, 7 Jun 2024 16:12:42 +0100 From: Catalin Marinas To: Michael Kelley Cc: Steven Price , "kvm@vger.kernel.org" , "kvmarm@lists.linux.dev" , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , "linux-coco@lists.linux.dev" , Ganapatrao Kulkarni Subject: Re: [PATCH v3 00/14] arm64: Support for running as a guest in Arm CCA Message-ID: References: <20240605093006.145492-1-steven.price@arm.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 Content-Disposition: inline In-Reply-To: On Fri, Jun 07, 2024 at 01:38:15AM +0000, Michael Kelley wrote: > From: Steven Price Sent: Wednesday, June 5, 2024 2:30 AM > > This series adds support for running Linux in a protected VM under the > > Arm Confidential Compute Architecture (CCA). This has been updated > > following the feedback from the v2 posting[1]. Thanks for the feedback! > > Individual patches have a change log for v3. > > > > The biggest change from v2 is fixing set_memory_{en,de}crypted() to > > perform a break-before-make sequence. Note that only the virtual address > > supplied is flipped between shared and protected, so if e.g. a vmalloc() > > address is passed the linear map will still point to the (now invalid) > > previous IPA. Attempts to access the wrong address may trigger a > > Synchronous External Abort. However any code which attempts to access > > the 'encrypted' alias after set_memory_decrypted() is already likely to > > be broken on platforms that implement memory encryption, so I don't > > expect problems. > > In the case of a vmalloc() address, load_unaligned_zeropad() could still > make an access to the underlying pages through the linear address. In > CoCo guests on x86, both the vmalloc PTE and the linear map PTE are > flipped, so the load_unaligned_zeropad() problem can occur only during > the transition between decrypted and encrypted. But even then, the > exception handlers have code to fixup this case and allow everything to > proceed normally. > > I haven't looked at the code in your patches, but do you handle that case, > or somehow prevent it? If we can guarantee that only full a vm_struct area is changed at a time, the vmap guard page would prevent this issue (not sure we can though). Otherwise I think we either change the set_memory_*() code to deal with the other mappings or we handle the exception. We also have potential user mappings, do we need to do anything about them? -- Catalin