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.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 20F4CC3567B for ; Mon, 24 Feb 2020 06:25:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC0E620661 for ; Mon, 24 Feb 2020 06:25:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="J9MjwsR9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbgBXGZw (ORCPT ); Mon, 24 Feb 2020 01:25:52 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35715 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726365AbgBXGZw (ORCPT ); Mon, 24 Feb 2020 01:25:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582525550; 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=dckTTjxyBibi0/eHSJpegNMnKv/ZFpoC0SMhoS98gYQ=; b=J9MjwsR9yWxHoBpvY6osQMej9F2RPXRVh0ZcTzMqRTgtr4fkOgBbb3YlfrVhOCdRHq2xXC jKxCot0ZRzTBBmr8If6HTmRqCBvUgXS739ET/A9q2TP1/TzJMfYR1IqojBrhPryvbOG2S9 8RiEFUprSXMkp93Ce+R69pUmKTVIAak= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-R58UNRq-MPqAMN2K99bKdw-1; Mon, 24 Feb 2020 01:25:49 -0500 X-MC-Unique: R58UNRq-MPqAMN2K99bKdw-1 Received: by mail-wr1-f72.google.com with SMTP id o9so5110138wrw.14 for ; Sun, 23 Feb 2020 22:25:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dckTTjxyBibi0/eHSJpegNMnKv/ZFpoC0SMhoS98gYQ=; b=C6hqNSE15KOi7VkLgZMa8ldULOvEGdgCJW1RH/1FYVozBGccMX21v/OAP7E1CZ/UsB ol6FPdjqgXpta0EcYwM1G01EGAU7mOSyVB8KIelSL7UhEC7QXcFjeO1W2AJ8V0RYCayZ l1xQ/CkKrosAH+ArnfiJBbhogN8jf6KH44B873WAFbXygg9o9nsg53mxJ4o+Kw3Vds/8 xNagFPIPb4LZV4twSIU6ja7NYiDDE3+pu7fo50pRFHJaoyt5cu6h3ANC58/5CgkIRLkh 1kzBlRKwATnFbFTeWiSflg1uEjmSrPY7i69VNFMe1WwNFAmN2ljzAtzH/LLnwoByESvS uBYA== X-Gm-Message-State: APjAAAWxY1t4gsrItJJdZu6wAbLJfkbq9+mt64xIko7kaWdYMgnk4nKD N10pA60+7WQrqAlRsJ2cxF9GznzFrW4t52m+ydzNYZdYE5vRVAPfAolkDESMVkvZBmCQCpImOpx 10vXSAAx9cK7hR4gVto/NEeIoZ1NAiUmpScoiwNgL X-Received: by 2002:a1c:6755:: with SMTP id b82mr20610993wmc.126.1582525547966; Sun, 23 Feb 2020 22:25:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyxA5kdvYr5b57CvBHEyg7SYwjy39EA3KJkD+2t/YLueVtODgOYqrVfSMUaLHTeag8+AJUU1fdINXjmJPOfgzU= X-Received: by 2002:a1c:6755:: with SMTP id b82mr20610946wmc.126.1582525547617; Sun, 23 Feb 2020 22:25:47 -0800 (PST) MIME-Version: 1.0 References: <1575057559-25496-1-git-send-email-bhsharma@redhat.com> <1575057559-25496-3-git-send-email-bhsharma@redhat.com> <63d6e63c-7218-d2dd-8767-4464be83603f@arm.com> <351975548.1986001.1578682810951.JavaMail.zimbra@redhat.com> <04287d60-e99e-631b-c134-d6dc39e6a193@redhat.com> <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> In-Reply-To: <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> From: Bhupesh Sharma Date: Mon, 24 Feb 2020 11:55:35 +0530 Message-ID: Subject: Re: [RESEND PATCH v5 2/5] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo To: Amit Kachhap Cc: Dave Anderson , James Morse , Mark Rutland , Ard Biesheuvel , Linux Doc Mailing List , Catalin Marinas , x86@kernel.org, kexec mailing list , Linux Kernel Mailing List , linuxppc-dev@lists.ozlabs.org, Kazuhito Hagio , bhupesh linux , Will Deacon , linux-arm-kernel , Steve Capper Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Amit, On Fri, Feb 21, 2020 at 2:36 PM Amit Kachhap wrote: > > Hi Bhupesh, > > On 1/13/20 5:44 PM, Bhupesh Sharma wrote: > > Hi James, > > > > On 01/11/2020 12:30 AM, Dave Anderson wrote: > >> > >> ----- Original Message ----- > >>> Hi Bhupesh, > >>> > >>> On 25/12/2019 19:01, Bhupesh Sharma wrote: > >>>> On 12/12/2019 04:02 PM, James Morse wrote: > >>>>> On 29/11/2019 19:59, Bhupesh Sharma wrote: > >>>>>> vabits_actual variable on arm64 indicates the actual VA space size, > >>>>>> and allows a single binary to support both 48-bit and 52-bit VA > >>>>>> spaces. > >>>>>> > >>>>>> If the ARMv8.2-LVA optional feature is present, and we are running > >>>>>> with a 64KB page size; then it is possible to use 52-bits of address > >>>>>> space for both userspace and kernel addresses. However, any kernel > >>>>>> binary that supports 52-bit must also be able to fall back to 48-bit > >>>>>> at early boot time if the hardware feature is not present. > >>>>>> > >>>>>> Since TCR_EL1.T1SZ indicates the size offset of the memory region > >>>>>> addressed by TTBR1_EL1 (and hence can be used for determining the > >>>>>> vabits_actual value) it makes more sense to export the same in > >>>>>> vmcoreinfo rather than vabits_actual variable, as the name of the > >>>>>> variable can change in future kernel versions, but the architectural > >>>>>> constructs like TCR_EL1.T1SZ can be used better to indicate intended > >>>>>> specific fields to user-space. > >>>>>> > >>>>>> User-space utilities like makedumpfile and crash-utility, need to > >>>>>> read/write this value from/to vmcoreinfo > >>>>> > >>>>> (write?) > >>>> > >>>> Yes, also write so that the vmcoreinfo from an (crashing) arm64 > >>>> system can > >>>> be used for > >>>> analysis of the root-cause of panic/crash on say an x86_64 host using > >>>> utilities like > >>>> crash-utility/gdb. > >>> > >>> I read this as as "User-space [...] needs to write to vmcoreinfo". > > > > That's correct. But for writing to vmcore dump in the kdump kernel, we > > need to read the symbols from the vmcoreinfo in the primary kernel. > > > >>>>>> for determining if a virtual address lies in the linear map range. > >>>>> > >>>>> I think this is a fragile example. The debugger shouldn't need to know > >>>>> this. > >>>> > >>>> Well that the current user-space utility design, so I am not sure we > >>>> can > >>>> tweak that too much. > >>>> > >>>>>> The user-space computation for determining whether an address lies in > >>>>>> the linear map range is the same as we have in kernel-space: > >>>>>> > >>>>>> #define __is_lm_address(addr) (!(((u64)addr) & > >>>>>> BIT(vabits_actual - > >>>>>> 1))) > >>>>> > >>>>> This was changed with 14c127c957c1 ("arm64: mm: Flip kernel VA > >>>>> space"). If > >>>>> user-space > >>>>> tools rely on 'knowing' the kernel memory layout, they must have to > >>>>> constantly be fixed > >>>>> and updated. This is a poor argument for adding this to something that > >>>>> ends up as ABI. > >>>> > >>>> See above. The user-space has to rely on some ABI/guaranteed > >>>> hardware-symbols which can be > >>>> used for 'determining' the kernel memory layout. > >>> > >>> I disagree. Everything and anything in the kernel will change. The > >>> ABI rules apply to > >>> stuff exposed via syscalls and kernel filesystems. It does not apply > >>> to kernel internals, > >>> like the memory layout we used yesterday. 14c127c957c1 is a case in > >>> point. > >>> > >>> A debugger trying to rely on this sort of thing would have to play > >>> catchup whenever it > >>> changes. > >> > >> Exactly. That's the whole point. > >> > >> The crash utility and makedumpfile are not in the same league as other > >> user-space tools. > >> They have always had to "play catchup" precisely because they depend > >> upon kernel internals, > >> which constantly change. > > > > I agree with you and DaveA here. Software user-space debuggers are > > dependent on kernel internals (which can change from time-to-time) and > > will have to play catch-up (which has been the case since the very start). > > > > Unfortunately we don't have any clear ABI for software debugging tools - > > may be something to look for in future. > > > > A case in point is gdb/kgdb, which still needs to run with KASLR > > turned-off (nokaslr) for debugging, as it confuses gdb which resolve > > kernel symbol address from symbol table of vmlinux. But we can > > work-around the same in makedumpfile/crash by reading the 'kaslr_offset' > > value. And I have several users telling me now they cannot use gdb on > > KASLR enabled kernel to debug panics, but can makedumpfile + crash > > combination to achieve the same. > > > > So, we should be looking to fix these utilities which are broken since > > the 52-bit changes for arm64. Accordingly, I will try to send the v6 > > soon while incorporating the comments posted on the v5. > > Any update on the next v6 version. Since this patch series is fixing the > current broken kdump so need this series to add some more fields in > vmcoreinfo for Pointer Authentication work. Sorry for the delay. I was caught up in some other urgent arm64 user-space issues. I am preparing the v6 now and hopefully will be able to post it out for review later today. Thanks, Bhupesh 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=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 38A45C3567B for ; Mon, 24 Feb 2020 10:29:31 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 A655E20828 for ; Mon, 24 Feb 2020 10:29:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QmcedYlA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A655E20828 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48Qywl6v5bzDqWs for ; Mon, 24 Feb 2020 21:29:27 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=207.211.31.120; helo=us-smtp-1.mimecast.com; envelope-from=bhsharma@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QmcedYlA; dkim-atps=neutral Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48QytQ2NFqzDqNZ for ; Mon, 24 Feb 2020 21:27:24 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582540042; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CjqxRZHSo8X8I7NzxQEu+Tymmt/ghwg/SLEiDBOhiic=; b=QmcedYlAV+SmriSISCI5Z83KHbhzO9Z/gE5+5vvx3vsO/MD7tebpzrhFSo+0sSWihfO8kG IfpoMcptnzz3RZmR6/H4jZQNuHRWo5jZNWRardBOvm733PUW7bVvOPxjd2zbLLDlgRYljf OgwQi8I+BKMRaamQmS3yMctu0Ff9O4E= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-0bmVWB6xP5enjg8IMIvioA-1; Mon, 24 Feb 2020 01:25:49 -0500 X-MC-Unique: 0bmVWB6xP5enjg8IMIvioA-1 Received: by mail-wr1-f72.google.com with SMTP id d15so5113445wru.1 for ; Sun, 23 Feb 2020 22:25:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dckTTjxyBibi0/eHSJpegNMnKv/ZFpoC0SMhoS98gYQ=; b=gvo/nd1luGOkjH2IcvgXk128fmo0Kf4JC2ZdUqhfLY200XvkqZSmV612/X1EGLG+Ys B5yDe/2kiEqS6Al5MMUZsDihy+AR4y83Yv3zXAocW5GSMs0kHWK5dLzdsOwWe2zdtkT5 AEwyNnfrvO88zKY83+pJ8lMzLvRhaZF38QqMlbn+TfHfh0844DWBrNV36qI/qmSIQCUj zPtHCuK1YMykUQOPHc2H8THtg9YRcuulfIwavkGiAHMCP8CokUpyyW7lYIqa0r3Ak6oz deiXsNR5IVsOl5kxBv8Rnv9sMWKUJAg70iXKLqzSb+hatWRLStHaVBiji8aytQiyZzdz Z5qw== X-Gm-Message-State: APjAAAUEnGOxYzS+tl6OC55mRnhNv3LYHgfkRIV0CHx0cdCRpsD2XQu9 c/Vr1/tccHy8idYOmH60HOe3Nv5zs3YYSDW8TAC1SZXhWnaOGPIizc0rw9Lz694k1BKALNp1CP7 pHkrwgevidsO2JcDkuOP/tauzyg4DafjHlfsp4A0AVg== X-Received: by 2002:a1c:6755:: with SMTP id b82mr20610978wmc.126.1582525547929; Sun, 23 Feb 2020 22:25:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyxA5kdvYr5b57CvBHEyg7SYwjy39EA3KJkD+2t/YLueVtODgOYqrVfSMUaLHTeag8+AJUU1fdINXjmJPOfgzU= X-Received: by 2002:a1c:6755:: with SMTP id b82mr20610946wmc.126.1582525547617; Sun, 23 Feb 2020 22:25:47 -0800 (PST) MIME-Version: 1.0 References: <1575057559-25496-1-git-send-email-bhsharma@redhat.com> <1575057559-25496-3-git-send-email-bhsharma@redhat.com> <63d6e63c-7218-d2dd-8767-4464be83603f@arm.com> <351975548.1986001.1578682810951.JavaMail.zimbra@redhat.com> <04287d60-e99e-631b-c134-d6dc39e6a193@redhat.com> <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> In-Reply-To: <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> From: Bhupesh Sharma Date: Mon, 24 Feb 2020 11:55:35 +0530 Message-ID: Subject: Re: [RESEND PATCH v5 2/5] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo To: Amit Kachhap X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , x86@kernel.org, Will Deacon , Linux Doc Mailing List , Catalin Marinas , Ard Biesheuvel , kexec mailing list , Linux Kernel Mailing List , Kazuhito Hagio , James Morse , Dave Anderson , bhupesh linux , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Steve Capper Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Amit, On Fri, Feb 21, 2020 at 2:36 PM Amit Kachhap wrote: > > Hi Bhupesh, > > On 1/13/20 5:44 PM, Bhupesh Sharma wrote: > > Hi James, > > > > On 01/11/2020 12:30 AM, Dave Anderson wrote: > >> > >> ----- Original Message ----- > >>> Hi Bhupesh, > >>> > >>> On 25/12/2019 19:01, Bhupesh Sharma wrote: > >>>> On 12/12/2019 04:02 PM, James Morse wrote: > >>>>> On 29/11/2019 19:59, Bhupesh Sharma wrote: > >>>>>> vabits_actual variable on arm64 indicates the actual VA space size= , > >>>>>> and allows a single binary to support both 48-bit and 52-bit VA > >>>>>> spaces. > >>>>>> > >>>>>> If the ARMv8.2-LVA optional feature is present, and we are running > >>>>>> with a 64KB page size; then it is possible to use 52-bits of addre= ss > >>>>>> space for both userspace and kernel addresses. However, any kernel > >>>>>> binary that supports 52-bit must also be able to fall back to 48-b= it > >>>>>> at early boot time if the hardware feature is not present. > >>>>>> > >>>>>> Since TCR_EL1.T1SZ indicates the size offset of the memory region > >>>>>> addressed by TTBR1_EL1 (and hence can be used for determining the > >>>>>> vabits_actual value) it makes more sense to export the same in > >>>>>> vmcoreinfo rather than vabits_actual variable, as the name of the > >>>>>> variable can change in future kernel versions, but the architectur= al > >>>>>> constructs like TCR_EL1.T1SZ can be used better to indicate intend= ed > >>>>>> specific fields to user-space. > >>>>>> > >>>>>> User-space utilities like makedumpfile and crash-utility, need to > >>>>>> read/write this value from/to vmcoreinfo > >>>>> > >>>>> (write?) > >>>> > >>>> Yes, also write so that the vmcoreinfo from an (crashing) arm64 > >>>> system can > >>>> be used for > >>>> analysis of the root-cause of panic/crash on say an x86_64 host usin= g > >>>> utilities like > >>>> crash-utility/gdb. > >>> > >>> I read this as as "User-space [...] needs to write to vmcoreinfo". > > > > That's correct. But for writing to vmcore dump in the kdump kernel, we > > need to read the symbols from the vmcoreinfo in the primary kernel. > > > >>>>>> for determining if a virtual address lies in the linear map range. > >>>>> > >>>>> I think this is a fragile example. The debugger shouldn't need to k= now > >>>>> this. > >>>> > >>>> Well that the current user-space utility design, so I am not sure we > >>>> can > >>>> tweak that too much. > >>>> > >>>>>> The user-space computation for determining whether an address lies= in > >>>>>> the linear map range is the same as we have in kernel-space: > >>>>>> > >>>>>> #define __is_lm_address(addr) (!(((u64)addr) & > >>>>>> BIT(vabits_actual - > >>>>>> 1))) > >>>>> > >>>>> This was changed with 14c127c957c1 ("arm64: mm: Flip kernel VA > >>>>> space"). If > >>>>> user-space > >>>>> tools rely on 'knowing' the kernel memory layout, they must have to > >>>>> constantly be fixed > >>>>> and updated. This is a poor argument for adding this to something t= hat > >>>>> ends up as ABI. > >>>> > >>>> See above. The user-space has to rely on some ABI/guaranteed > >>>> hardware-symbols which can be > >>>> used for 'determining' the kernel memory layout. > >>> > >>> I disagree. Everything and anything in the kernel will change. The > >>> ABI rules apply to > >>> stuff exposed via syscalls and kernel filesystems. It does not apply > >>> to kernel internals, > >>> like the memory layout we used yesterday. 14c127c957c1 is a case in > >>> point. > >>> > >>> A debugger trying to rely on this sort of thing would have to play > >>> catchup whenever it > >>> changes. > >> > >> Exactly. That's the whole point. > >> > >> The crash utility and makedumpfile are not in the same league as other > >> user-space tools. > >> They have always had to "play catchup" precisely because they depend > >> upon kernel internals, > >> which constantly change. > > > > I agree with you and DaveA here. Software user-space debuggers are > > dependent on kernel internals (which can change from time-to-time) and > > will have to play catch-up (which has been the case since the very star= t). > > > > Unfortunately we don't have any clear ABI for software debugging tools = - > > may be something to look for in future. > > > > A case in point is gdb/kgdb, which still needs to run with KASLR > > turned-off (nokaslr) for debugging, as it confuses gdb which resolve > > kernel symbol address from symbol table of vmlinux. But we can > > work-around the same in makedumpfile/crash by reading the 'kaslr_offset= ' > > value. And I have several users telling me now they cannot use gdb on > > KASLR enabled kernel to debug panics, but can makedumpfile + crash > > combination to achieve the same. > > > > So, we should be looking to fix these utilities which are broken since > > the 52-bit changes for arm64. Accordingly, I will try to send the v6 > > soon while incorporating the comments posted on the v5. > > Any update on the next v6 version. Since this patch series is fixing the > current broken kdump so need this series to add some more fields in > vmcoreinfo for Pointer Authentication work. Sorry for the delay. I was caught up in some other urgent arm64 user-space issues. I am preparing the v6 now and hopefully will be able to post it out for review later today. Thanks, Bhupesh 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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 95F70C3567B for ; Mon, 24 Feb 2020 06:26:14 +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 658F720658 for ; Mon, 24 Feb 2020 06:26:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uF0QqWST"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Djyj4wHR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 658F720658 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rWH4+u5VZ6fgw4QTL506o2DYmivcVFeRsuyL2/tZMyk=; b=uF0QqWSTwFBdf1 fvvbtHZAv9fFaD0CsRvEFLjmZJ+Tw5XBMAHtPiIebMFamemOiVPs+waaU28noR4ZFK/ir3yDx0JNW g0b2ft2eWeR6m/Fp+U3ePoEzLZ6ih9L1odioZVpVgvclEorZmbZ6cFpqjcTmPygzIIjI9H7AMRDWp bUWeDiraqEolGvS4D/z8W9sJKHaH4+0QFo216xVjKH9mimfp4Z2R6dV8YEH5P3kVZm5Q80KHZ0bxc 1Td3y6OY2OFIOx3Qr7129LK/9wR1BmlKQAooxLqhsHeIQym/Lf5R5KkDFBH/YXx0DWHcg9OoJ4xT1 o9ykFyWDfWI/bhr006gA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j67Bu-000321-Ly; Mon, 24 Feb 2020 06:26:06 +0000 Received: from us-smtp-1.mimecast.com ([205.139.110.61] helo=us-smtp-delivery-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j67Br-00030e-1b for linux-arm-kernel@lists.infradead.org; Mon, 24 Feb 2020 06:26:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582525561; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CjqxRZHSo8X8I7NzxQEu+Tymmt/ghwg/SLEiDBOhiic=; b=Djyj4wHRJFqK3aBt8ayxqCjn9vP0fu/yuIyI6k28qA24jyqDiMmvQrOQ7o6cZctL5SQYyr QNJl3OmM3HNHv2dLo3gM8NCTaEMXuHyYN/awAm0DEQCc9gr4+gYmEfX5JSnat6uiymLEyO sHglsthLWPo/Onv8bMw2EollTZGhP0I= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-b2dIXv__PyaIT9TnifuHPA-1; Mon, 24 Feb 2020 01:25:49 -0500 X-MC-Unique: b2dIXv__PyaIT9TnifuHPA-1 Received: by mail-wr1-f72.google.com with SMTP id d9so1889082wrv.21 for ; Sun, 23 Feb 2020 22:25:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dckTTjxyBibi0/eHSJpegNMnKv/ZFpoC0SMhoS98gYQ=; b=H0b1B9FHS21mOH1MbLmr+lEEcyP7CY9m877waT6gkHIGp5aqmHEghNsRNm69io+RGl N7/pas0rQUb//1Inkuc6WlMFLzKL2W9bjlpBraBYvcS5X1c51n54r6NFratbCMxQAaVM 2voh7g3dILP4QM9oe2OyxUYZkPgRWz20c5ba1YhRqozpbj62GKp6XHGoncUhNh8Sdo4Z daU3p76MT4y6Lw1Fwj5DTpOb3gBaYbU90UoOWJb9EOzXQnmqpPb3CCpVMrn6io5w4ScF 56lh48JLSHmEol0Fx7Dbhh33sskO16lSiA+I01cDIKFRPACAxqyh7HKRZsXGaMCdw0pV Oixw== X-Gm-Message-State: APjAAAVKabBSuyyQIFIRL5BQ/5T0cm8YK0P7bOs+G5FPnPyjRFgmEMrp Ynq93hnbV9qdEOt75CNzmLcBBoI/e2jHxDHnqx5+umB8Kz+NBcL/9QklxzEuFLO3gUDQZdmvcG3 jpD+OyIXf62tRnesMNFIN66zNNTgS1yKCvPmmakBndJuDdVJ51qw= X-Received: by 2002:a1c:6755:: with SMTP id b82mr20610990wmc.126.1582525547931; Sun, 23 Feb 2020 22:25:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyxA5kdvYr5b57CvBHEyg7SYwjy39EA3KJkD+2t/YLueVtODgOYqrVfSMUaLHTeag8+AJUU1fdINXjmJPOfgzU= X-Received: by 2002:a1c:6755:: with SMTP id b82mr20610946wmc.126.1582525547617; Sun, 23 Feb 2020 22:25:47 -0800 (PST) MIME-Version: 1.0 References: <1575057559-25496-1-git-send-email-bhsharma@redhat.com> <1575057559-25496-3-git-send-email-bhsharma@redhat.com> <63d6e63c-7218-d2dd-8767-4464be83603f@arm.com> <351975548.1986001.1578682810951.JavaMail.zimbra@redhat.com> <04287d60-e99e-631b-c134-d6dc39e6a193@redhat.com> <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> In-Reply-To: <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> From: Bhupesh Sharma Date: Mon, 24 Feb 2020 11:55:35 +0530 Message-ID: Subject: Re: [RESEND PATCH v5 2/5] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo To: Amit Kachhap X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200223_222603_165889_2DB1B055 X-CRM114-Status: GOOD ( 35.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , x86@kernel.org, Will Deacon , Linux Doc Mailing List , Catalin Marinas , Ard Biesheuvel , kexec mailing list , Linux Kernel Mailing List , Kazuhito Hagio , James Morse , Dave Anderson , bhupesh linux , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Steve Capper Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Amit, On Fri, Feb 21, 2020 at 2:36 PM Amit Kachhap wrote: > > Hi Bhupesh, > > On 1/13/20 5:44 PM, Bhupesh Sharma wrote: > > Hi James, > > > > On 01/11/2020 12:30 AM, Dave Anderson wrote: > >> > >> ----- Original Message ----- > >>> Hi Bhupesh, > >>> > >>> On 25/12/2019 19:01, Bhupesh Sharma wrote: > >>>> On 12/12/2019 04:02 PM, James Morse wrote: > >>>>> On 29/11/2019 19:59, Bhupesh Sharma wrote: > >>>>>> vabits_actual variable on arm64 indicates the actual VA space size, > >>>>>> and allows a single binary to support both 48-bit and 52-bit VA > >>>>>> spaces. > >>>>>> > >>>>>> If the ARMv8.2-LVA optional feature is present, and we are running > >>>>>> with a 64KB page size; then it is possible to use 52-bits of address > >>>>>> space for both userspace and kernel addresses. However, any kernel > >>>>>> binary that supports 52-bit must also be able to fall back to 48-bit > >>>>>> at early boot time if the hardware feature is not present. > >>>>>> > >>>>>> Since TCR_EL1.T1SZ indicates the size offset of the memory region > >>>>>> addressed by TTBR1_EL1 (and hence can be used for determining the > >>>>>> vabits_actual value) it makes more sense to export the same in > >>>>>> vmcoreinfo rather than vabits_actual variable, as the name of the > >>>>>> variable can change in future kernel versions, but the architectural > >>>>>> constructs like TCR_EL1.T1SZ can be used better to indicate intended > >>>>>> specific fields to user-space. > >>>>>> > >>>>>> User-space utilities like makedumpfile and crash-utility, need to > >>>>>> read/write this value from/to vmcoreinfo > >>>>> > >>>>> (write?) > >>>> > >>>> Yes, also write so that the vmcoreinfo from an (crashing) arm64 > >>>> system can > >>>> be used for > >>>> analysis of the root-cause of panic/crash on say an x86_64 host using > >>>> utilities like > >>>> crash-utility/gdb. > >>> > >>> I read this as as "User-space [...] needs to write to vmcoreinfo". > > > > That's correct. But for writing to vmcore dump in the kdump kernel, we > > need to read the symbols from the vmcoreinfo in the primary kernel. > > > >>>>>> for determining if a virtual address lies in the linear map range. > >>>>> > >>>>> I think this is a fragile example. The debugger shouldn't need to know > >>>>> this. > >>>> > >>>> Well that the current user-space utility design, so I am not sure we > >>>> can > >>>> tweak that too much. > >>>> > >>>>>> The user-space computation for determining whether an address lies in > >>>>>> the linear map range is the same as we have in kernel-space: > >>>>>> > >>>>>> #define __is_lm_address(addr) (!(((u64)addr) & > >>>>>> BIT(vabits_actual - > >>>>>> 1))) > >>>>> > >>>>> This was changed with 14c127c957c1 ("arm64: mm: Flip kernel VA > >>>>> space"). If > >>>>> user-space > >>>>> tools rely on 'knowing' the kernel memory layout, they must have to > >>>>> constantly be fixed > >>>>> and updated. This is a poor argument for adding this to something that > >>>>> ends up as ABI. > >>>> > >>>> See above. The user-space has to rely on some ABI/guaranteed > >>>> hardware-symbols which can be > >>>> used for 'determining' the kernel memory layout. > >>> > >>> I disagree. Everything and anything in the kernel will change. The > >>> ABI rules apply to > >>> stuff exposed via syscalls and kernel filesystems. It does not apply > >>> to kernel internals, > >>> like the memory layout we used yesterday. 14c127c957c1 is a case in > >>> point. > >>> > >>> A debugger trying to rely on this sort of thing would have to play > >>> catchup whenever it > >>> changes. > >> > >> Exactly. That's the whole point. > >> > >> The crash utility and makedumpfile are not in the same league as other > >> user-space tools. > >> They have always had to "play catchup" precisely because they depend > >> upon kernel internals, > >> which constantly change. > > > > I agree with you and DaveA here. Software user-space debuggers are > > dependent on kernel internals (which can change from time-to-time) and > > will have to play catch-up (which has been the case since the very start). > > > > Unfortunately we don't have any clear ABI for software debugging tools - > > may be something to look for in future. > > > > A case in point is gdb/kgdb, which still needs to run with KASLR > > turned-off (nokaslr) for debugging, as it confuses gdb which resolve > > kernel symbol address from symbol table of vmlinux. But we can > > work-around the same in makedumpfile/crash by reading the 'kaslr_offset' > > value. And I have several users telling me now they cannot use gdb on > > KASLR enabled kernel to debug panics, but can makedumpfile + crash > > combination to achieve the same. > > > > So, we should be looking to fix these utilities which are broken since > > the 52-bit changes for arm64. Accordingly, I will try to send the v6 > > soon while incorporating the comments posted on the v5. > > Any update on the next v6 version. Since this patch series is fixing the > current broken kdump so need this series to add some more fields in > vmcoreinfo for Pointer Authentication work. Sorry for the delay. I was caught up in some other urgent arm64 user-space issues. I am preparing the v6 now and hopefully will be able to post it out for review later today. Thanks, Bhupesh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel