From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A16B2C4363A for ; Mon, 26 Oct 2020 14:37:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 567C12168B for ; Mon, 26 Oct 2020 14:37:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Xoacv0bE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Pqj0b7NA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 567C12168B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hzvG1nB7uodLJ2dQ/z1KPnhHkN9I7hn39ztzumsJPqg=; b=Xoacv0bEEhFM4Dym+su3L85QI OyMNwOagRUqemLEui0ewrui0iwf+Plu5hrpc2/QG7q8CqCDkbUKXm5ZwOVWSHJgtb3xpiO+r+uUpA 7I0U+QWmqBtq03STKAiIxAKQe+GCapxrkyLwjYnmHt0jn2tPZp5TjvaWYBlzprkXWEFLSobHMPEk+ LyOWGvRF5YgwBRVISiI0l9Pnr0axQUJY8vHRwzs8bsSCjqp6gBSmEWUw/8mwx6A0FuCZCykwB50uO cBj6ygTcppWtc2qAd/ChxPaivpHLqGfaivJeOmmr1ExXrDNbsW8kmqUWTwIm2b0rjEJFfBjlrXEdc ZhcFv1+nw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX3bt-00019J-B8; Mon, 26 Oct 2020 14:36:33 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX3bq-000183-HU for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 14:36:31 +0000 Received: by mail-wm1-x343.google.com with SMTP id k21so5852929wmi.1 for ; Mon, 26 Oct 2020 07:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MerDsv/XmBWBzmLIOlTgREdfdkOm0MotoeVYk/L2CXA=; b=Pqj0b7NAxAQeGChbWijWaY4tsNONaAR9oWWuCz66Rw4h3OvJOXQRMudZ+Rp+j3Bo3X JncmRLLVjT6tY5sgPuZ7iWz8Bj0uvPru028mnI+pJs8h+/FqmdDCNbgCRnrlFel++ifw iOwzQyimqGCGDTwM/i5wxNwoa8GS+9T2U4WXahJW4qImsDZuVCP+BI69yLwIZb0e5TP6 DVbNdVRVVwWXmBfiPsfcNkKasuDoPIW1bsL3jUbGkGzijWc7CnBMfhG4C+FRJ4ukWyUK 5hG0llpleWM1WFGvZNHkZWqZd/2e0t93rAFOREJp1pHqaLHvNnma1EKIcplUoPHwUX9S HdLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MerDsv/XmBWBzmLIOlTgREdfdkOm0MotoeVYk/L2CXA=; b=sjExHyoDvOJqX+IqlEkWWY4lDfJSUIaf2VDJtctJiX+lVx3BL9Ajg6uEp6UuVbpD3c CJTqWmp4vPZzctRjQWbl+0luJkWCoN7sGOhvxQXZr84HHuOBUCPuVrGoemG00RKXK2iK pesaUDyvM9/Kc2QXKOALbYgO26IS25pqRgLcklYZKhu5wZaA8otTMDFHJ8wbeOZgdkot 7pGr1M7bxyQ4TV6JOvyfUsMGoycUqTKSw45LsJW2ho0CZAiDpRgq2AL5IwvngtwF2FZH 6Nfp2bPfLAgWF3UPz4/DODtLd3LFJTc6WEUJP4F3L/CBBdf1z+wAclZIDvB3d2XjPgI5 MTWQ== X-Gm-Message-State: AOAM532ce1vD74Hv3W9Qj0pyzwGUxmgIagV+KV3m4xwBQ9UMgHrvWkkh H9dOZ7UETSoGLzeSIGtwsGHBsg== X-Google-Smtp-Source: ABdhPJyeJBArajEh/qV0h65NryMws8JKnoPSvxRiqZYn8gQ8o5uMxcIaCVxiY2Ofp3J6w3GhdnhfXw== X-Received: by 2002:a7b:c0d3:: with SMTP id s19mr6858264wmh.102.1603722987718; Mon, 26 Oct 2020 07:36:27 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:f693:9fff:fef4:a7ef]) by smtp.gmail.com with ESMTPSA id c18sm20080039wmk.36.2020.10.26.07.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2020 07:36:27 -0700 (PDT) Date: Mon, 26 Oct 2020 14:36:23 +0000 From: Quentin Perret To: Marc Zyngier Subject: Re: [PATCH 1/8] KVM: arm64: Don't corrupt tpidr_el2 on failed HVC call Message-ID: <20201026143623.GA2229434@google.com> References: <20201026095116.72051-1-maz@kernel.org> <20201026095116.72051-2-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201026095116.72051-2-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_103630_653319_A4822AAA X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Suzuki K Poulose , kernel-team@android.com, James Morse , linux-arm-kernel@lists.infradead.org, Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry , Andrew Scull Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Monday 26 Oct 2020 at 09:51:09 (+0000), Marc Zyngier wrote: > The hyp-init code starts by stashing a register in TPIDR_EL2 > in in order to free a register. This happens no matter if the > HVC call is legal or not. > > Although nothing wrong seems to come out of it, it feels odd > to alter the EL2 state for something that eventually returns > an error. > > Instead, use the fact that we know exactly which bits of the > __kvm_hyp_init call are non-zero to perform the check with > a series of EOR/ROR instructions, combined with a build-time > check that the value is the one we expect. Alternatively, could we make __kvm_hyp_init non-SMCCC compliant? While I understand how it makes sense to be compliant for 'proper' HVCs, this one really is an odd one that only makes sense on a very transient state. That would let us define our convention, and we can just say x0-x18 can be clobbered like any function call, which eradicates the issue Andrew tried to avoid with this tpidr_el2 trick. Thoughts? Thanks, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel