From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BCC517753 for ; Thu, 26 Dec 2024 03:48:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735184901; cv=none; b=Ce1L1Wkl4nyACTjmZ3CqT0huWUcbdJHUndlARobj4wUxO0tU6XzsPTKGHEmdzMV2zkUlKXHQizV3qogzhApx/TkAA3rzDwJdqfCdEz08+HqRbfFsiThydAON7vYCxkS9A5S4BUiYTtkZ2NlVZqefBP+HiSYuUTIk8Dx4l0Xzi8g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735184901; c=relaxed/simple; bh=Lhph/I6gbYU21PzcexrHU8uEjOwBW5MlJsSqLqWps/Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mUkfXjajvFzZRw7ASGyl/Ni2pYyd26L8srcA22mcXJQGfOiv+tbcXBFUEJ4TMXapzhOJYZ0diaQhveDB24L3ostD9hfDKuIqwsNgqA9WSwqroLsHgurlG6hmCN+bb1EhTwscP/jO0AwtI4ZiU2s91c4Ng9pQGfXp7D2NWfI3FSM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eK3VmPrz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eK3VmPrz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1735184897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t3kXmqxoB2WnQIF/6kBgYMhgzGVNPo+6AgunOKSP1Vw=; b=eK3VmPrzHBAizyEjqSTFpvh9EoZ6reAFsxKqW9w1eslcbCK1fHevJ9tP8stJD6SkAM0Cw1 arw4Zkr66AfvWQMYVj/VQegchFMkx5HMDB/LRj9Tpy1+wQcC6URKFcSBV016KEIqQtcRm7 0TmijRNsFCHF76llogQkYkAAiJ7vcDU= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-T9sa9dDGNIqCi8XeV6EZpg-1; Wed, 25 Dec 2024 22:48:14 -0500 X-MC-Unique: T9sa9dDGNIqCi8XeV6EZpg-1 X-Mimecast-MFC-AGG-ID: T9sa9dDGNIqCi8XeV6EZpg Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A76F719560B2; Thu, 26 Dec 2024 03:48:11 +0000 (UTC) Received: from localhost (unknown [10.72.112.202]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0DEA41956086; Thu, 26 Dec 2024 03:48:08 +0000 (UTC) Date: Thu, 26 Dec 2024 11:48:04 +0800 From: Baoquan He To: Coiby Xu Cc: kexec@lists.infradead.org, Ondrej Kozina , Milan Broz , Thomas Staudt , Daniel P =?iso-8859-1?Q?=2E_Berrang=E9?= , Kairui Song , Jan Pazdziora , Pingfan Liu , Dave Young , linux-kernel@vger.kernel.org, x86@kernel.org, Dave Hansen , Vitaly Kuznetsov , Greg KH , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH v6 6/7] x86/crash: pass dm crypt keys to kdump kernel Message-ID: References: <20241029055223.210039-1-coxu@redhat.com> <20241029055223.210039-7-coxu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 On 12/23/24 at 09:16am, Coiby Xu wrote: > On Wed, Dec 11, 2024 at 08:55:52PM +0800, Baoquan He wrote: > > On 10/29/24 at 01:52pm, Coiby Xu wrote: ...... > > > diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c > > > index 68530fad05f7..9c94428927bd 100644 > > > --- a/arch/x86/kernel/kexec-bzimage64.c > > > +++ b/arch/x86/kernel/kexec-bzimage64.c > > > @@ -76,6 +76,10 @@ static int setup_cmdline(struct kimage *image, struct boot_params *params, > > > if (image->type == KEXEC_TYPE_CRASH) { > > > len = sprintf(cmdline_ptr, > > > "elfcorehdr=0x%lx ", image->elf_load_addr); > > > + > > > + if (image->dm_crypt_keys_addr != 0) > > > + len += sprintf(cmdline_ptr + len, > > > + "dmcryptkeys=0x%lx ", image->dm_crypt_keys_addr); > > > } > > > memcpy(cmdline_ptr + len, cmdline, cmdline_len); > > > cmdline_len += len; > > > @@ -441,6 +445,9 @@ static void *bzImage64_load(struct kimage *image, char *kernel, > > > ret = crash_load_segments(image); > > > if (ret) > > > return ERR_PTR(ret); > > > + ret = crash_load_dm_crypt_keys(image); > > > + if (ret) > > > + pr_debug("Either no dm crypt key or error to retrieve the dm crypt key\n"); > > > > If it's error, do we need change ti to pr_debug? > > Thanks for raising the concern! I think it's OK to let > crash_load_dm_crypt_keys fail since disk encryption may not be used for > kdump, thus pr_debug is sufficient. Or have I misunderstood your comment? If crash_load_dm_crypt_keys() returned error, shouldn't we handle them separately? If disk encryption is not used, we return a specific value to indicate that, surely no need to pr_err(). However, if disk encryption is used for kdump but error is caused and failed crash_load_dm_crypt_keys(), why don't we error out for the case? Maybe below change can be made to differentiate them? diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c index f72a88b7d106..327f84ea57c5 100644 --- a/kernel/crash_dump_dm_crypt.c +++ b/kernel/crash_dump_dm_crypt.c @@ -400,7 +400,7 @@ int crash_load_dm_crypt_keys(struct kimage *image) if (key_count <= 0) { kexec_dprintk("No dm-crypt keys\n"); - return -EINVAL; + return -ENOENT; }