Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6027746imm; Mon, 23 Jul 2018 10:06:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd1Z3GsdE7O821Qmd7HRk1ZILQvQXzbdqea0G5o00QSxBvvcXWh412L5KNOO08h5LjpZHwZ X-Received: by 2002:a65:49c7:: with SMTP id t7-v6mr13072352pgs.23.1532365613848; Mon, 23 Jul 2018 10:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532365613; cv=none; d=google.com; s=arc-20160816; b=v1Quu0VapiQSH3+JjudPqaH6ezIriqAWCsQGBzRt/T9QIRHWKscPwRV9D87yJ0u2lw nwJYt0uDaAVc53A45LycnZ0KWRG3CZKG+Af9zRWpnC0VIPj3HYJWFF8M5Il7icCWPt+e pXKE0N1QZHOrfQ1ZXpctGNxkbzQ6+mRAqKWSjmRBluN8Nue8B8CVzBj7bgf3wKNTu8k1 F1LxWYsK+al0PHNbdaP3OOs5VTZYG9GbrfMhCVRM2cAOIHjRdvuCsx1DOseHbF9PUjcX pk+pJSbN//bCz4BI7q7C4PI1e+y7wCJDvEOkau+D1esXtNagSQ894TGfvqhvlvC33JAK soDg== 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=M+ls9SSTLjkkXw4ADUEwMgZveVRGrMZXtEFMMbVIdEI=; b=ymKGkrIVI7JIrTCB61mGFPZCszpJ7rp8MuMZNPoY7MF4i5vJCau/GWq+FMozYVBKRa YuMqYJ+cm4qbaqTSPjNXbrlqTfdmar3fU5Sicups0oXLnMcpFTzDqpa4MbCd40tzNrrH nbpphXucqA6+63bxyZDGfc5tC7rY3a+E4bUS2fYmKi6918PB7d2WVdgE9Xse25Yhzy8v +BK0Ma4aKS5DP9LuA6hkTYk1+ZzVSx0YYRANXwCo7ciLCo8qv6jGgCPUWIzIbZ5v32df GRyIviU1tmLXAvDu1fWdb1ujLrADgsqF4thDdqOwDlekclrpsdsRilnia6exmSdRldOc 0yeg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26-v6si9039039pfj.188.2018.07.23.10.06.38; Mon, 23 Jul 2018 10:06:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388831AbeGWSH7 (ORCPT + 99 others); Mon, 23 Jul 2018 14:07:59 -0400 Received: from foss.arm.com ([217.140.101.70]:36982 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388200AbeGWSH7 (ORCPT ); Mon, 23 Jul 2018 14:07:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5147218A; Mon, 23 Jul 2018 10:05:50 -0700 (PDT) Received: from [10.4.12.81] (melchizedek.emea.arm.com [10.4.12.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BFE43F5D0; Mon, 23 Jul 2018 10:05:48 -0700 (PDT) Subject: Re: [PATCH] arm64, kaslr: export offset in VMCOREINFO ELF notes To: Bhupesh Sharma Cc: linux-arm-kernel , Linux Kernel Mailing List , kexec mailing list , Bhupesh SHARMA , AKASHI Takahiro , Ard Biesheuvel , Will Deacon , Mark Rutland , Catalin Marinas , linux-mips@linux-mips.org References: <1531949864-27447-1-git-send-email-bhsharma@redhat.com> From: James Morse Message-ID: <9c4d7c8d-3f0b-ff2f-68e8-03638a5fe2a4@arm.com> Date: Mon, 23 Jul 2018 18:05:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bhupesh, (CC: +mips list, looks like mips is missing vmcore's KERNELOFFSET too. Start of this thread: https://lkml.org/lkml/2018/7/18/951 ) On 19/07/18 15:55, Bhupesh Sharma wrote: > On Thu, Jul 19, 2018 at 5:01 PM, James Morse wrote: >> On 18/07/18 22:37, Bhupesh Sharma wrote: >>> 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. >> >> You need the kernel VA for a symbol. Isn't this what kallsyms is for? >> | root@frikadeller:~# cat /proc/kallsyms | grep swapper_pg_dir >> | ffff5404610d0000 B swapper_pg_dir > Its already used by other archs like x86_64. > Its just that we are enabling this feature for arm64 now that the > KASLR boot cases are more widely seen on arm64 boards (as newer EFI > firmware implementations are available which support EFI_RNG_PROTOCOL > and hence KASLR boot). > > And we want existing user-space application(s) to work similarly on > arm64 distributions as they work historically on other archs like > x86_64 (in most cases the user-space user is not even aware, if he is > developing for or using an underlying hardware which is arm64 or > x86_64) Aha, so its ABI. This is the information that should be in the commit message as it describes why this patch should be merged. ... Ideally core code would do this, that way this information won't be missed when an architecture adds KASLR support. But mips has CONFIG_RANDOMIZE_BASE, and doesn't provide kaslr_offset(), and x86 always provides this value, not just if CONFIG_RANDOMIZE_BASE is selected. I can't see a way to do this without touching all three architectures. (we can try and tidy it up once its clear whether mips needs this too) I think the patch is fine, but could you re-post it with a commit message that describes that vmcore parsing in user-space already expects this value in the notes. We're providing it for portability of those existing tools with x86. >> I picked swapper_pg_dir, but you could use any of the vmcore:SYMBOL() addresses >> to work out this offset. (you should expect the kernel to rename these symbols >> at a whim). >> > > Perhaps you missed what the above makedumpfile command was doing, so > let me summarize again: Yes, I glossed over it, all that seemed relevant is you are trying to find the kernel-va of a symbol from the value in the vmlinux. > as it breaks the > existing user-space use-cases and the .conf file can be user-defined > (and hence he can pick any symbol/functions My suggestion was you can calculate the offset between the link-time and run-time address from information you already have. You just need one of each. This would be better as its independent of how the kernel does the relocation. But, this is irrelevant as 'KERNELOFFSET=' is already an ABI string. > which might not even be present in 'kallsyms'). Eh? How can that happen? I thought even modules had their symbols added to kallsyms. Thanks, James