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=-10.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, 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 1E374C43214 for ; Mon, 2 Aug 2021 13:48:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 055E761104 for ; Mon, 2 Aug 2021 13:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234116AbhHBNsT (ORCPT ); Mon, 2 Aug 2021 09:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234260AbhHBNrw (ORCPT ); Mon, 2 Aug 2021 09:47:52 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66380C061381 for ; Mon, 2 Aug 2021 06:47:33 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id l11-20020a7bcf0b0000b0290253545c2997so8862wmg.4 for ; Mon, 02 Aug 2021 06:47:33 -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=ZosgW5P/FRPWGDl9IhPM3Dl11PT0YSNjES1UOYC23P4=; b=iSwcVNXbwMj6bVndtAFh7/bVmULdw+Y4ZH4kvjV+Mb+DxmGuikESzaj9cZHzvQhcFz 2eSHGQSrKDRpbtKb/YrDbNUibFkKb8uFFnLk+qF8lmUt43Ukaxxq/v2lDPf36NI/ZRr1 VXf1q8muGbwUkVEgTkW2yIhJfPzY1gVV7HEaMODfE67CUAezeMGlH1xyXDm8GyIAqTSf X2Ye+SXcHcjI8EFlHa5CEW/ZYQ/qXGLCRNdkqaBRZhA7vMLLuIJlJUa8IM00fF1ft3l0 8Jrr8L8IQh/ExzlathQ0Iqs3f13X25ek8ua+hPjVzfA0RJPAWlAii6VnDph3LkL1thD0 AatA== 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=ZosgW5P/FRPWGDl9IhPM3Dl11PT0YSNjES1UOYC23P4=; b=PounmMeVZsQsNLUv98KreEqYqzMxfZbCjvac82IMRuqNsd2CJhWDQR7Qsin+H4cXtw 9mGcciCadzNAoszR3t/QRvdVa8DhrQvXlUCWBdShZK0PDpby9jEoIqIqyViKAwhEJxzI jWyZd1Dkh1aBATz7PW09eHn/9S5xje/8rnD1c0EbFeMl7mQQu9OtRdnjJyA40c3UYLJJ 8XByYWWOEOHOJSMjwLlIvTh/vwdoo2krJu2wkk5+LYLPScmf7+lKR66PE/ySbS6m4pGP 1yt1OXyrIDWA703OCLRQWxjIYObWFFXfsTonheD+BU8R3XMJA0qrDxluCCvy0N3Etqw4 7/RQ== X-Gm-Message-State: AOAM530HRt/SXKtsHxAzOniQhMmc018wizAXZX9xG98QswqTcY/MQUIL xfG5ZujKqfturSk1m52pjvv4eg== X-Google-Smtp-Source: ABdhPJyu3MDRDzEwimKK8eR6XfIVIZgUH41B1Kmkh8eOZJZPZLglJQmXQDBg756DblUv9SmM0jIVwQ== X-Received: by 2002:a05:600c:2306:: with SMTP id 6mr16843468wmo.115.1627912051856; Mon, 02 Aug 2021 06:47:31 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:44fe:c9a8:c2b2:3798]) by smtp.gmail.com with ESMTPSA id b14sm11551749wrm.43.2021.08.02.06.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 06:47:31 -0700 (PDT) Date: Mon, 2 Aug 2021 14:47:28 +0100 From: Quentin Perret To: Marc Zyngier Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Will Deacon , Catalin Marinas , kernel-team@android.com, stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] arm64: Move .hyp.rodata outside of the _sdata.._edata range Message-ID: References: <20210802123830.2195174-1-maz@kernel.org> <20210802123830.2195174-2-maz@kernel.org> <87mtq00yqd.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87mtq00yqd.wl-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Monday 02 Aug 2021 at 14:20:42 (+0100), Marc Zyngier wrote: > Hi Quentin, > > On Mon, 02 Aug 2021 14:11:07 +0100, > Quentin Perret wrote: > > > > Hi Marc, > > > > On Monday 02 Aug 2021 at 13:38:29 (+0100), Marc Zyngier wrote: > > > The HYP rodata section is currently lumped together with the BSS, > > > which isn't exactly what is expected (it gets registered with > > > kmemleak, for example). > > > > > > Move it away so that it is actually marked RO. As an added > > > benefit, it isn't registered with kmemleak anymore. > > > > 2d7bf218ca73 ("KVM: arm64: Add .hyp.data..ro_after_init ELF section") > > states explicitly that the hyp ro_after_init section should remain RW in > > the host as it is expected to modify it before initializing EL2. But I > > can't seem to trigger anything with this patch applied, so I'll look > > into this a bit more. > > The switch to RO happens quite late. And if the host was to actually > try and change things there, it would be screwed anyway (we will have > already removed the pages from its S2). Yes, clearly mapping rodata RO in host happens much later than I thought, so this should indeed be fine. > I wouldn't be surprised if this was a consequence of the way we now > build the HYP object, and the comment in the original commit may not > be valid anymore. Just had a quick look and that still seems valid, at least for some things (e.g. see how we set hyp_cpu_logical_map[] early from EL1 while it is clearly annotated as __ro_after_init in the EL2 code). > > > > > Fixes: 380e18ade4a5 ("KVM: arm64: Introduce a BSS section for use at Hyp") > > > > Not sure this is the patch to blame? > > My bad, this is plain wrong. I'm not sure it can be applied earlier > though if my rambling above is correct. By the look of it going all the way back to 2d7bf218ca73 (in David's PSCI proxy series) should actually be correct. But not sure if that's really going to make a difference before the patch you've mentioned above as the kmemleak issue will only be visible once we have a host stage-2, so no big deal. Thanks, Quentin 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=-0.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FSL_HELO_FAKE,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 E5055C4338F for ; Mon, 2 Aug 2021 13:47:36 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 61F7061131 for ; Mon, 2 Aug 2021 13:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 61F7061131 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E56C740839; Mon, 2 Aug 2021 09:47:35 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5jC3Qw+-pHpx; Mon, 2 Aug 2021 09:47:34 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BCCA44A49C; Mon, 2 Aug 2021 09:47:34 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 375214A2E5 for ; Mon, 2 Aug 2021 09:47:34 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vtIRyDI9txcx for ; Mon, 2 Aug 2021 09:47:33 -0400 (EDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 1821040617 for ; Mon, 2 Aug 2021 09:47:33 -0400 (EDT) Received: by mail-wm1-f48.google.com with SMTP id e25-20020a05600c4b99b0290253418ba0fbso17334wmp.1 for ; Mon, 02 Aug 2021 06:47:33 -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=ZosgW5P/FRPWGDl9IhPM3Dl11PT0YSNjES1UOYC23P4=; b=iSwcVNXbwMj6bVndtAFh7/bVmULdw+Y4ZH4kvjV+Mb+DxmGuikESzaj9cZHzvQhcFz 2eSHGQSrKDRpbtKb/YrDbNUibFkKb8uFFnLk+qF8lmUt43Ukaxxq/v2lDPf36NI/ZRr1 VXf1q8muGbwUkVEgTkW2yIhJfPzY1gVV7HEaMODfE67CUAezeMGlH1xyXDm8GyIAqTSf X2Ye+SXcHcjI8EFlHa5CEW/ZYQ/qXGLCRNdkqaBRZhA7vMLLuIJlJUa8IM00fF1ft3l0 8Jrr8L8IQh/ExzlathQ0Iqs3f13X25ek8ua+hPjVzfA0RJPAWlAii6VnDph3LkL1thD0 AatA== 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=ZosgW5P/FRPWGDl9IhPM3Dl11PT0YSNjES1UOYC23P4=; b=R2pGmWRoRoZ2ruDVqjpxt5axSbjYXiGicEH1Bu092LLg4N0V4svYOY8AebcnyV6JF6 m+rH+811UgIB6DlkIdkywgEfTGtbbrOIRIMkcd3lqHOEeOKmXlxWJ6sit6wO7sLecZrI rqPfd2GsUo1sFeHR1iW3R1llSaB+dWW25ycXvWocKxfpXUp02jTqhA/3VGVrXvlIDwmj IecUvzUX5oV3AMBytVvEN47FVE+q+SACFlV6N4iRpyOP8KB2jfq3kjxAnX5AtGNR9MDv 67FU7BOkLI7qgmEe1hxPXb862/4gwUQXWoxPAF+Rf4hreS7Y7gXh+Omx9cVQ8G0Gkcve XG/w== X-Gm-Message-State: AOAM531PJIDHC2ACcZJs8FyV1grLE3ICPAPIHLPlHCU0YK3SRxUafodL KxDkN50vFu654Tm8Eo2X86IwRw== X-Google-Smtp-Source: ABdhPJyu3MDRDzEwimKK8eR6XfIVIZgUH41B1Kmkh8eOZJZPZLglJQmXQDBg756DblUv9SmM0jIVwQ== X-Received: by 2002:a05:600c:2306:: with SMTP id 6mr16843468wmo.115.1627912051856; Mon, 02 Aug 2021 06:47:31 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:44fe:c9a8:c2b2:3798]) by smtp.gmail.com with ESMTPSA id b14sm11551749wrm.43.2021.08.02.06.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 06:47:31 -0700 (PDT) Date: Mon, 2 Aug 2021 14:47:28 +0100 From: Quentin Perret To: Marc Zyngier Subject: Re: [PATCH v2 1/2] arm64: Move .hyp.rodata outside of the _sdata.._edata range Message-ID: References: <20210802123830.2195174-1-maz@kernel.org> <20210802123830.2195174-2-maz@kernel.org> <87mtq00yqd.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87mtq00yqd.wl-maz@kernel.org> Cc: kernel-team@android.com, kvm@vger.kernel.org, Will Deacon , stable@vger.kernel.org, Catalin Marinas , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Monday 02 Aug 2021 at 14:20:42 (+0100), Marc Zyngier wrote: > Hi Quentin, > > On Mon, 02 Aug 2021 14:11:07 +0100, > Quentin Perret wrote: > > > > Hi Marc, > > > > On Monday 02 Aug 2021 at 13:38:29 (+0100), Marc Zyngier wrote: > > > The HYP rodata section is currently lumped together with the BSS, > > > which isn't exactly what is expected (it gets registered with > > > kmemleak, for example). > > > > > > Move it away so that it is actually marked RO. As an added > > > benefit, it isn't registered with kmemleak anymore. > > > > 2d7bf218ca73 ("KVM: arm64: Add .hyp.data..ro_after_init ELF section") > > states explicitly that the hyp ro_after_init section should remain RW in > > the host as it is expected to modify it before initializing EL2. But I > > can't seem to trigger anything with this patch applied, so I'll look > > into this a bit more. > > The switch to RO happens quite late. And if the host was to actually > try and change things there, it would be screwed anyway (we will have > already removed the pages from its S2). Yes, clearly mapping rodata RO in host happens much later than I thought, so this should indeed be fine. > I wouldn't be surprised if this was a consequence of the way we now > build the HYP object, and the comment in the original commit may not > be valid anymore. Just had a quick look and that still seems valid, at least for some things (e.g. see how we set hyp_cpu_logical_map[] early from EL1 while it is clearly annotated as __ro_after_init in the EL2 code). > > > > > Fixes: 380e18ade4a5 ("KVM: arm64: Introduce a BSS section for use at Hyp") > > > > Not sure this is the patch to blame? > > My bad, this is plain wrong. I'm not sure it can be applied earlier > though if my rambling above is correct. By the look of it going all the way back to 2d7bf218ca73 (in David's PSCI proxy series) should actually be correct. But not sure if that's really going to make a difference before the patch you've mentioned above as the kmemleak issue will only be visible once we have a host stage-2, so no big deal. Thanks, Quentin _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-1.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, 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 71A7AC4320A for ; Mon, 2 Aug 2021 13:49:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 443E9610FC for ; Mon, 2 Aug 2021 13:49:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 443E9610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=Yuf/UpgsPGn8Fdcmf7QL9VgoXJ/p84FhxISlTAuxELI=; b=2ermx5BlaAZuXa Cu0sy3fH7BBp4la1YB+GM6pgYsmRC1g0HLiTCueWmlzVPn6V2iYmUwJES1MmLBaQQe+23isDnn8gy CIwbATGayoZSCdeZbqLuk0qQVfh7pmPN7b8iYjoXRXw7Tz+CT4Rf55J8X1Juf1nQM7IT48DGAJihI 8IN7dISlvejs/A7dTLTtpasp61gO4FcJxwvPijSM2x/ll8P3TNZ71cV6sa86zbf/n2cjYCnhzIjgj j7GiqxN2i0jGdRNofGNI8ow/tnL5rky/7TySQ2Sx75MUEZWePrgtPC5R1DbRynMfe2NYYDuLk6oHu JlHfQU9cAvdXawGgAtkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAYI5-00GU3y-6X; Mon, 02 Aug 2021 13:47:37 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAYI1-00GU39-AB for linux-arm-kernel@lists.infradead.org; Mon, 02 Aug 2021 13:47:34 +0000 Received: by mail-wm1-x334.google.com with SMTP id h24-20020a1ccc180000b029022e0571d1a0so5229wmb.5 for ; Mon, 02 Aug 2021 06:47:33 -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=ZosgW5P/FRPWGDl9IhPM3Dl11PT0YSNjES1UOYC23P4=; b=iSwcVNXbwMj6bVndtAFh7/bVmULdw+Y4ZH4kvjV+Mb+DxmGuikESzaj9cZHzvQhcFz 2eSHGQSrKDRpbtKb/YrDbNUibFkKb8uFFnLk+qF8lmUt43Ukaxxq/v2lDPf36NI/ZRr1 VXf1q8muGbwUkVEgTkW2yIhJfPzY1gVV7HEaMODfE67CUAezeMGlH1xyXDm8GyIAqTSf X2Ye+SXcHcjI8EFlHa5CEW/ZYQ/qXGLCRNdkqaBRZhA7vMLLuIJlJUa8IM00fF1ft3l0 8Jrr8L8IQh/ExzlathQ0Iqs3f13X25ek8ua+hPjVzfA0RJPAWlAii6VnDph3LkL1thD0 AatA== 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=ZosgW5P/FRPWGDl9IhPM3Dl11PT0YSNjES1UOYC23P4=; b=swDtid83ClvhC53oiD03w8iBMqQ7INKT2NM7vpYW/44l2bX1mXUwqTihr1Vy6QiDOp lzIgrXZEeKZFfSyRZ0HYzNL0EYT0fLVITUt3rQlC6iaksu1nwAV37gRkAc8AkKRexdjV oxqJGYS6N5AznBfHBE9n88hjKA41tXoDj7hQ4w56CrXiHRpmKM0AsULWRJScT/jEhoZR kc7qU8AHqEijaDINEDA8olM1UTTvscvTLxLXvEhCEf4y3HwNyl8jnkaQ1IZR6so1NCp6 cIwyPQf7jGFHdfwP+RcPpL5juCjK8kup4QwiA1o1t4gRK6vZfwaK7htKVxYdUASHSAr3 Q/aw== X-Gm-Message-State: AOAM531nSHU1f5fwfb2EHW3qO1tQXPzwlqNXIgonP3hzyPxgq40MoE72 PUw/+U9O48DJIvnmpnEnDKUTpA== X-Google-Smtp-Source: ABdhPJyu3MDRDzEwimKK8eR6XfIVIZgUH41B1Kmkh8eOZJZPZLglJQmXQDBg756DblUv9SmM0jIVwQ== X-Received: by 2002:a05:600c:2306:: with SMTP id 6mr16843468wmo.115.1627912051856; Mon, 02 Aug 2021 06:47:31 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:44fe:c9a8:c2b2:3798]) by smtp.gmail.com with ESMTPSA id b14sm11551749wrm.43.2021.08.02.06.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 06:47:31 -0700 (PDT) Date: Mon, 2 Aug 2021 14:47:28 +0100 From: Quentin Perret To: Marc Zyngier Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Will Deacon , Catalin Marinas , kernel-team@android.com, stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] arm64: Move .hyp.rodata outside of the _sdata.._edata range Message-ID: References: <20210802123830.2195174-1-maz@kernel.org> <20210802123830.2195174-2-maz@kernel.org> <87mtq00yqd.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87mtq00yqd.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210802_064733_415984_A64307AA X-CRM114-Status: GOOD ( 30.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 02 Aug 2021 at 14:20:42 (+0100), Marc Zyngier wrote: > Hi Quentin, > > On Mon, 02 Aug 2021 14:11:07 +0100, > Quentin Perret wrote: > > > > Hi Marc, > > > > On Monday 02 Aug 2021 at 13:38:29 (+0100), Marc Zyngier wrote: > > > The HYP rodata section is currently lumped together with the BSS, > > > which isn't exactly what is expected (it gets registered with > > > kmemleak, for example). > > > > > > Move it away so that it is actually marked RO. As an added > > > benefit, it isn't registered with kmemleak anymore. > > > > 2d7bf218ca73 ("KVM: arm64: Add .hyp.data..ro_after_init ELF section") > > states explicitly that the hyp ro_after_init section should remain RW in > > the host as it is expected to modify it before initializing EL2. But I > > can't seem to trigger anything with this patch applied, so I'll look > > into this a bit more. > > The switch to RO happens quite late. And if the host was to actually > try and change things there, it would be screwed anyway (we will have > already removed the pages from its S2). Yes, clearly mapping rodata RO in host happens much later than I thought, so this should indeed be fine. > I wouldn't be surprised if this was a consequence of the way we now > build the HYP object, and the comment in the original commit may not > be valid anymore. Just had a quick look and that still seems valid, at least for some things (e.g. see how we set hyp_cpu_logical_map[] early from EL1 while it is clearly annotated as __ro_after_init in the EL2 code). > > > > > Fixes: 380e18ade4a5 ("KVM: arm64: Introduce a BSS section for use at Hyp") > > > > Not sure this is the patch to blame? > > My bad, this is plain wrong. I'm not sure it can be applied earlier > though if my rambling above is correct. By the look of it going all the way back to 2d7bf218ca73 (in David's PSCI proxy series) should actually be correct. But not sure if that's really going to make a difference before the patch you've mentioned above as the kmemleak issue will only be visible once we have a host stage-2, so no big deal. Thanks, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel