Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp317373pxb; Wed, 11 Nov 2020 04:36:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7WoN3hsq3sQJal0NVjPwAZTSfiG7fXzlPgM62o5yyA4Km1zCXcj+K+uvBlMur/8u62JnC X-Received: by 2002:a50:e443:: with SMTP id e3mr4916201edm.160.1605098190019; Wed, 11 Nov 2020 04:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605098190; cv=none; d=google.com; s=arc-20160816; b=ge5UF0aPxKmbIhxbnKsrKTlZBztFoKzsfcVKhJ3j7wmhUtPW6KmUIIid5JPfCTThBL dMorob5gkmaO6mErtkDfXGpXxVhZvYtJ23sqcq92qPp3iJX8wfYZ7nLYx+3SetoTmMyM K2vBm+YsOxNUi0k+LGHdTu+VumvUBcTsxxh/IwiHBJZKZhlN33zUpTlmf8ui5k9dODZd ATu5O10OBraChlTR3TjnCeLGOCsdOY1v5cmwZE7nsl9nKAl1ro34uMIGO6iMdkB7gVdr KvixeXwAL3/MOdnEUFLuBeFClXXM2TnRhr5RMAhiLqeXOzyCTQp/xJXupxHAACvdhoua ok2w== 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=XtEuYJqpVWdYVZAacuVpb6hyxFgTbQMkbAIhltpNKL8=; b=p6e7blhBpS6ghpEUYdFpLZZH08JR10RZ7Puue+Mm4RvczpND40D47XdEYoTkaWkux1 pexKwRpIfggYAfGvJnFpSzeDI/5jIKE0vJ6Ro8ezGwdi6WgbNfNj7ujO0Vl35dAd7t4X y0pddTWOaqbrAzTGxcn46V/xVN24mRJD2veKYP4i4FXBBFryWb/Jo9V/fiBOJVGsq3Ac rK3p+A38z3iarCJdiw5y89HE637nBBGEeq11HJwEhq2aQ8piN1aRDAE2bUdcrZgz5sZs PBgvl8dbqP6xImyZKUXh1OVk6euY0Vf30HLwhF+PZN7w0LvexQAKEpjoYSaSUTlo8gcs 6qdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ja7qkn/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si1123531eja.728.2020.11.11.04.36.05; Wed, 11 Nov 2020 04:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ja7qkn/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726207AbgKKMc1 (ORCPT + 99 others); Wed, 11 Nov 2020 07:32:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbgKKMc0 (ORCPT ); Wed, 11 Nov 2020 07:32:26 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F725C0613D1 for ; Wed, 11 Nov 2020 04:32:26 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id a3so2149365wmb.5 for ; Wed, 11 Nov 2020 04:32:26 -0800 (PST) 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=XtEuYJqpVWdYVZAacuVpb6hyxFgTbQMkbAIhltpNKL8=; b=Ja7qkn/lq9oiqwC27+zkFQJeArO4GLvWWzlfFEwQ4TlruRJR5FzFVktlan4lAT8uhT GTABF5yUj9gP5jOMJ9b5esYLbeH5VjnSC//QJghLJYlz73VNRELC20/ketIza7Dr2R8U cCkGoBD7R6CNx1xup45TuhqV+reaJnR2Cd0zcdo6OcHKd6Sxt4z0Np1Bu6C2Z5LKmWKV 5UgF385H5RiSnyWytK9qT7kC4gPbObKUnFyLIn3MFhVEWNO4irXz27rtFMVJsspRyhBJ 1uT0ZDHMKlz9yGFhLJjHKc+kpshuA1VbkZOaClTXU0YlDhhMESkMLX080Wqtp0Qw9iIF DR3Q== 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=XtEuYJqpVWdYVZAacuVpb6hyxFgTbQMkbAIhltpNKL8=; b=N9YlOwdMaEpzPiuEaw4V59QLW3rEfFA+nB4678gNl71QBsOBcCGvi1ccwQ7z5z7G0H IX1dr+CeZNPsQHuV6QxtdgQwK6tPoaGcNBFmlFbQZSnbkoXz1SB9qaHJqA9eNRWglE2p QPZmA41xRQy2QrstSUKaQgQGQsgam4HtENvtUO/s8hB/rWdx/WvuNtxysguc8CxcnnzU 40dSYJBJ+7XodMbQDZIw/FgdMBs1yXpGsS7WVUzIBi6i7frCsQcIFMjbR8owwKMdOnoV FH4G6rIe9CU1ifu1Ao70BhQ1wvx8AF7XAQ02o+iHn9ANuvDSN2lu6LsTf8nt6KsNWmcI +kCQ== X-Gm-Message-State: AOAM530581KBBF30bj/O0iBt0BNmnDJJ2ugvGflkEbuTE5bjLkpN47UY o6vdfs+2pb0TyC6/so4sfZoRhA== X-Received: by 2002:a7b:c384:: with SMTP id s4mr3911891wmj.77.1605097945020; Wed, 11 Nov 2020 04:32:25 -0800 (PST) Received: from google.com ([2a01:4b00:8523:2d03:2595:ed05:1717:fe6e]) by smtp.gmail.com with ESMTPSA id q16sm2414688wrn.13.2020.11.11.04.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 04:32:23 -0800 (PST) Date: Wed, 11 Nov 2020 12:32:22 +0000 From: David Brazdil To: Marc Zyngier Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Quentin Perret , Andrew Scull , Andrew Walbran , kernel-team@android.com Subject: Re: [PATCH v1 06/24] kvm: arm64: Support per_cpu_ptr in nVHE hyp code Message-ID: <20201111123222.ooevu6nryu3ncphv@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> <20201109113233.9012-7-dbrazdil@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > + > > + cpu_base_array = kern_hyp_va(&kvm_arm_hyp_percpu_base[0]); > > There is no guarantee that this will not generate a PC relative > addressing, resulting in kern_hyp_va() being applied twice. > > Consider using hyp_symbol_addr() instead, which always does the right > by forcing a PC relative addressing and not subsequently mangling > the address. > > > + this_cpu_base = kern_hyp_va(cpu_base_array[cpu]); > > + return this_cpu_base - (unsigned long)&__per_cpu_start; > > And this is the opposite case: if the compiler generates an absolute > address, you're toast. Yes, this is just as unlikely, but hey... > Same remedy should apply. Good point, and I'll probably keep forgetting about this in the future. Now that all .hyp.text is only executed under hyp page tables, should we start thinking about fixing up the relocations?