Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp998925imm; Wed, 18 Jul 2018 14:40:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeWcmQ0uGdrW2FT2PBTSgMXhA/VQ38WRMcXvPwDLOWZpQNe4yr/GffJdZAIhYX97af17PWB X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr7433244plz.282.1531950003085; Wed, 18 Jul 2018 14:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531950003; cv=none; d=google.com; s=arc-20160816; b=NO7M1A+oajCBV65HGseh2lrQWwxeDOsoU8lX3YwCdu8PnNL5GEuYiXE9TqCJ1SDfoZ Eynwem4UUmFGyBtj3DlQSC989VljPZmiFOcjeDDRB+qmnRnHWtGDpRjd3fHL0IuAd6XF 0y6aaiNFG5m95mQXuPaT2KxLvX8Wyr73crKkDeILzyTtZ+5u8w8YB23HOqEqlkTp9UnT VlIKBwKezYlxP0h29HkG3eGkbKJ7BI3Iu6iMdvxCi/reNR0PKyk5C4Ie+BV03ZzAAN40 uzvuTyFVHCOcmqppIJP9URGgiwznKi4Un8rMKTRy+/PfwoUCalROsj6tzwyC0BWf78gm 67iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GBK6tzyDUvOa6mQFoL7jPStc6L4dBwNl9kDKqprSzg4=; b=JzD0wb1/AmZQdfvv97D+qLbaYzxWR29g0ggnFTw5IDC3YlSoYtzaP947ZgTLA+5G1t 4dQuuCbIdBXIBENsUzGiheSpEhz3NtCg3dLSAO1k3loyjMiWDnD1a7RBxvj0uqYzsDiQ 1LZTPmiuUeASbETnWXxoQ0WdS5VCeT9AGuHAWz7XxNndfBCqfKozsx5YqWlUcayc7o0H 2JKPYuir1CrUp0gK+aRmy3T0Q6qN3JsWSkKC+fphUTbgB+lF/l5LKaCepwC7fT50U3t4 tYY3/EMMH8xeS7+IRdMQY3a8a2ZhIxIHjdycenb869PvWlu9KanwMQWvolc7mCU3Wk8h Ti6Q== 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 l10-v6si4344491pgb.510.2018.07.18.14.39.48; Wed, 18 Jul 2018 14:40:03 -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 S1730505AbeGRWRv (ORCPT + 99 others); Wed, 18 Jul 2018 18:17:51 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35841 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbeGRWRu (ORCPT ); Wed, 18 Jul 2018 18:17:50 -0400 Received: by mail-pg1-f193.google.com with SMTP id m19-v6so2585925pgv.3 for ; Wed, 18 Jul 2018 14:38:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GBK6tzyDUvOa6mQFoL7jPStc6L4dBwNl9kDKqprSzg4=; b=JZ4JHfr+lL9eMGuNYFqMT38XmQ4myz37w3nonhoaIj9oz6jfhBAwOpPPFBJ1KRxZ2V r571JNcM7CyJ6zIGrcDByD1KxDYIvc17NeOKsLwKrzu1VMfVZ/2tQpRHPVVwP0BKFyC+ 7aOAOit1enh8YiJ5UQYJ/9vRxO1dQ5ibLc5JplTGqXe6MaWFgQ+oXfI8xXR3hZeAg2jN G1BSikDF40eZMJsKS7AA10E2vCr8TFfK2pxZ5r9g9bTU9fqCsoNrvfDF5XnrLCLXYoU4 TGf+E6HtoGI2LGvgriHbMqdu/QW4UKkpyWZB5Ro1zN3RECgXIdt0DOGV/vhvHp1YvKmQ 3RiA== X-Gm-Message-State: AOUpUlEcldGsmjlhWzs0N8pW6FnL8VpUHwDfMZbrZq4qV6Sp+NjqUrDL iWX1Y+mKm/5EHI0DtaXhMxuxoQ== X-Received: by 2002:a63:a44a:: with SMTP id c10-v6mr7261837pgp.198.1531949882233; Wed, 18 Jul 2018 14:38:02 -0700 (PDT) Received: from localhost ([2405:204:1408:e6f0:4529:2779:e150:51d8]) by smtp.gmail.com with ESMTPSA id d9-v6sm9155364pfb.86.2018.07.18.14.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 14:38:00 -0700 (PDT) From: Bhupesh Sharma To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, bhupesh.linux@gmail.com, takahiro.akashi@linaro.org, Bhupesh Sharma , Ard Biesheuvel , Will Deacon , Mark Rutland , Catalin Marinas , James Morse Subject: [PATCH] arm64, kaslr: export offset in VMCOREINFO ELF notes Date: Thu, 19 Jul 2018 03:07:44 +0530 Message-Id: <1531949864-27447-1-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Include KASLR offset in VMCOREINFO ELF notes to assist in debugging. makedumpfile user-space utility will need fixup to use this KASLR offset to work with cases where we need to find a way to translate symbol address from vmlinux to kernel run time address in case of KASLR boot on arm64. I already have those fixup ready, which will be sent upstream once this patch makes through (see [0]). I tested this on my qualcomm amberwing board both for KASLR and non-KASLR boot cases: Without this patch: # cat > scrub.conf << EOF [vmlinux] erase jiffies erase init_task.utime for tsk in init_task.tasks.next within task_struct:tasks erase tsk.utime endfor EOF # makedumpfile --split -d 31 -x vmlinux --config scrub.conf vmcore dumpfile_{1,2,3} readpage_elf: Attempt to read non-existent page at 0xffffa8a5bf180000. readmem: type_addr: 1, addr:ffffa8a5bf180000, size:8 vaddr_to_paddr_arm64: Can't read pgd readmem: Can't convert a virtual address(ffff0000092a542c) to physical address. readmem: type_addr: 0, addr:ffff0000092a542c, size:390 check_release: Can't get the address of system_utsname After this patch check_release() is ok, and also we are able to erase symbol from vmcore (I checked this with kernel 4.18.0-rc4+): # makedumpfile --split -d 31 -x vmlinux --config scrub.conf vmcore dumpfile_{1,2,3} The kernel version is not supported. The makedumpfile operation may be incomplete. Checking for memory holes : [100.0 %] \ Checking for memory holes : [100.0 %] | Checking foExcluding unnecessary pages : [100.0 %] \ Excluding unnecessary pages : [100.0 %] \ The dumpfiles are saved to dumpfile_1, dumpfile_2, and dumpfile_3. makedumpfile Completed. [0] https://github.com/bhupesh-sharma/makedumpfile/commit/555e5ae0fb2b21797c450ad55950e81c470224ef Cc: Ard Biesheuvel Cc: Will Deacon Cc: Mark Rutland Cc: Catalin Marinas Cc: James Morse Signed-off-by: Bhupesh Sharma --- arch/arm64/kernel/machine_kexec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index f62effc6e064..028df356a5fd 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -360,4 +360,5 @@ void arch_crash_save_vmcoreinfo(void) kimage_voffset); vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n", PHYS_OFFSET); + vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset()); } -- 2.7.4