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=-8.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 4D137C433DF for ; Wed, 14 Oct 2020 15:53:10 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 D3A772222A for ; Wed, 14 Oct 2020 15:53:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3A772222A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.6802.17917 (Exim 4.92) (envelope-from ) id 1kSj5C-00016F-AC; Wed, 14 Oct 2020 15:52:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 6802.17917; Wed, 14 Oct 2020 15:52:54 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kSj5C-000168-6j; Wed, 14 Oct 2020 15:52:54 +0000 Received: by outflank-mailman (input) for mailman id 6802; Wed, 14 Oct 2020 15:52:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kSj5A-000163-PW for xen-devel@lists.xenproject.org; Wed, 14 Oct 2020 15:52:52 +0000 Received: from mail-wr1-f67.google.com (unknown [209.85.221.67]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2eaafcb1-5579-408d-91e0-4802d2a56182; Wed, 14 Oct 2020 15:52:52 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id y12so4485916wrp.6 for ; Wed, 14 Oct 2020 08:52:51 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id h16sm5868732wre.87.2020.10.14.08.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 08:52:50 -0700 (PDT) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kSj5A-000163-PW for xen-devel@lists.xenproject.org; Wed, 14 Oct 2020 15:52:52 +0000 X-Inumbo-ID: 2eaafcb1-5579-408d-91e0-4802d2a56182 Received: from mail-wr1-f67.google.com (unknown [209.85.221.67]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2eaafcb1-5579-408d-91e0-4802d2a56182; Wed, 14 Oct 2020 15:52:52 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id y12so4485916wrp.6 for ; Wed, 14 Oct 2020 08:52:51 -0700 (PDT) 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:user-agent; bh=9bsO4XTS8Ud4pEmBCazMT/i3UmJ173+XZwgvkVsK8QM=; b=fcrM+2EpdzKj61GTNYF/tqNtXFmE/KbktHCQielfSOom/qf1UuxrtG1SCruZ6DrFMB YuPv8QePXqcuzCPychTspZxE1cQojLejrcMYXmyn7GGfphTS401reSXIDlU/WB+TOD89 zusfXbZXxmBENpZOzAgYg/qga4xkoDBb/zG406KbU7HuhQWu9Q95P+s+WMA+IKHXGzoO xduIjRrX8ipnQ4+fRpBtgsGymu98wT1zo/5sG07PgqUDpr8XnrPrz7BhmJv10e11zhUm V/2j0ywiVSl3x79YpzqTkulE6iZA8rNyXbUn4NWL/jOk62IIJJRfXJ29sLdguMV5upLL A1ug== X-Gm-Message-State: AOAM533o/O1rKb6KBFheOHTVts0bH2Q/uglBCI2g9+nmAO/OWbCqlWtx sUQ5w18FzZZj/JuUbUC5lS0= X-Google-Smtp-Source: ABdhPJxetcPUnvNy08/XzDzvnZ4VKNAsuFXTRz0s7wZtnUMj5IU7yl72Xhx8Iu85Eb9VDn6lKv8Lvg== X-Received: by 2002:adf:e70a:: with SMTP id c10mr6124532wrm.425.1602690771200; Wed, 14 Oct 2020 08:52:51 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id h16sm5868732wre.87.2020.10.14.08.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 08:52:50 -0700 (PDT) Date: Wed, 14 Oct 2020 15:52:49 +0000 From: Wei Liu To: Jason Andryuk Cc: xen-devel@lists.xenproject.org, Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: Re: [PATCH] libelf: Handle PVH kernels lacking ENTRY elfnote Message-ID: <20201014155249.42zw6vvoteom4iff@liuwe-devbox-debian-v2> References: <20201014153150.83875-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201014153150.83875-1-jandryuk@gmail.com> User-Agent: NeoMutt/20180716 On Wed, Oct 14, 2020 at 11:31:50AM -0400, Jason Andryuk wrote: > Linux kernels only have an ENTRY elfnote when built with CONFIG_PV. A > kernel build CONFIG_PVH=y CONFIG_PV=n lacks the note. In this case, > virt_entry will be UNSET_ADDR, overwritten by the ELF header e_entry, > and fail the check against the virt address range. > > Change the code to only check virt_entry against the virtual address > range if it was set upon entry to the function. > > Signed-off-by: Jason Andryuk > > --- > Maybe the overwriting of virt_entry could be removed, but I don't know > if there would be unintended consequences where (old?) kernels don't > have an elfnote, but do have an in-range e_entry? The failing kernel I > just looked at has an e_entry of 0x1000000. > > Oh, it looks like Mini-OS doesn't set the entry ELFNOTE and relies on > e_entry (of 0) to pass these checks. > I have not looked into the patch, but please don't use mini-os as a source for truth. ;-) It is more likely than not we should fix mini-os instead of Xen and Linux. Wei.