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=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 93991C388F9 for ; Wed, 11 Nov 2020 12:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 31B972072C for ; Wed, 11 Nov 2020 12:32:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Ja7qkn/l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbgKKMc1 (ORCPT ); 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-Google-Smtp-Source: ABdhPJyMdXM5aicXN5Ib33YGeRQlcphSIsMKmTWL4A6/3D5qrbO5zhbeG85AQYouCaWcr+Nk5zMANQ== 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?