Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1030920imm; Tue, 3 Jul 2018 04:26:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKINXHS4Swq0uS2DHrapRrnTyu5U/MER1Ws2EnmWxHbsM2glvo/lI6uXHkIO7I4549IzjUDQ X-Received: by 2002:a63:bc0a:: with SMTP id q10-v6mr25129413pge.70.1530617191680; Tue, 03 Jul 2018 04:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530617191; cv=none; d=google.com; s=arc-20160816; b=wro4wgssecWGDjfJWx5rk/bodE8ZtxYZ3INFEVk/jIRkKUKmlzkSVaBnSZMCWkV/mU iggZI/yDHvjdxw9vV1rU4yN1cuW+HlVISSM9WN2vS2nd32VeNkejwT8QZT6C5r3pE13G sI9Er8LNCoGC4wsZ2V7XH2LzivO72Pil6o65CfCMpTEVmHK2vn05pqEnHG0D38t+rOk7 88KwC0P2ctS3s5PJyVYcDtEy5c1mac7+WPSaBSoTwXhOQiGi9/ACACowO0luIZ2ikrEl cqxezRgdJPdcUcxcj9fwIvRfpOEQ3vFiamk+shUB4E8PtO5xaZRMwClzlrbU1/rQExad cBiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=gGJv8nL/j2ohyCVyf7yafifXQesegIuLIn9TEGNSlpc=; b=iUtIDbYBiEJGqysn60H/Bf1OuBnqFYnogRZUvA8z78DG7044IYZJGsWGF+E+YOczUr /7rIi/QtA/j/M3UFhJH5Hi6eJMz5JdkksX7ZfstJUXWZq8OR+G+a3ZqMY5Jpl8KUBGmn uyCv4UpBTVk9kn6kaH2OyzyYKD3+/P7v/N3Z2hzSiMdD6915eWVMIGDvNMk0QVGzsQk1 NGmPhvnikUjh1GlYGfsvZqegtyVY796Kwh8uQIkOhOv1Xg4XfWS0lYVKYj9eSIxD05j5 d5iVOhwSIsT8A74VCpc9uRJHFx6lqtXXHi2g55fBgoK/CjlUBtZl8glq3xg3dCN/pUW9 V75w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si946748pld.114.2018.07.03.04.26.17; Tue, 03 Jul 2018 04:26:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752965AbeGCLZe (ORCPT + 99 others); Tue, 3 Jul 2018 07:25:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40094 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752596AbeGCLZa (ORCPT ); Tue, 3 Jul 2018 07:25:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5110A72634; Tue, 3 Jul 2018 11:25:30 +0000 (UTC) Received: from localhost.localdomain (ovpn-12-173.pek2.redhat.com [10.72.12.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2EA4C2026D76; Tue, 3 Jul 2018 11:25:24 +0000 (UTC) Subject: Re: [PATCH 1/5 V5] Add a function(ioremap_encrypted) for kdump when AMD sme enabled To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, ebiederm@xmission.com, joro@8bytes.org, thomas.lendacky@amd.com, dyoung@redhat.com, kexec@lists.infradead.org, iommu@lists.linux-foundation.org, bhe@redhat.com References: <20180702072639.10110-1-lijiang@redhat.com> <20180702072639.10110-2-lijiang@redhat.com> <20180702101451.GB28730@zn.tnic> <4ae1cfb5-0a4b-2aac-2575-024e2c74826f@redhat.com> <20180703093924.GA5748@zn.tnic> From: lijiang Message-ID: <55b86851-4978-9289-8a1f-012c6114ec9e@redhat.com> Date: Tue, 3 Jul 2018 19:25:21 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180703093924.GA5748@zn.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 03 Jul 2018 11:25:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 03 Jul 2018 11:25:30 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lijiang@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2018年07月03日 17:39, Borislav Petkov 写道: > On Tue, Jul 03, 2018 at 10:17:19AM +0800, lijiang wrote: >> for example, the elfcorehdr. In fact, the elfcorehdr and notes > > You mean this? > > ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos) > { > - return read_from_oldmem(buf, count, ppos, 0); > + return read_from_oldmem(buf, count, ppos, 0, sme_active()); > > That looks encrypted to me. > The elf notes is an old memory, it is encrypted. But the elf header is a crash kernel reserved memory, which is unencrypted. ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos) { - return read_from_oldmem(buf, count, ppos, 0); + return read_from_oldmem(buf, count, ppos, 0, false); } They call the same function(read_from_oldmem->ioremap_cache), so it is hard to properly remap the memory if we don't use the parameter to distinguish. Regards, Lianbo >> call the same function(read_from_oldmem->ioremap_cache), in this case, >> it is very difficult to properly remap the memory if the caller don't >> care whether the memory is encrypted. > > So beef up the logic in __ioremap_caller() to figure out based on the > address whether to access the memory encrypted or not. You can find out > the elfcorehdr address in the capture kernel. >