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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 27A45C433F5 for ; Sat, 16 Apr 2022 00:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=isywJAJrBAp+8s/p8I7gqdSbk0JxqrNbYpW3zBaFHlg=; b=Y/FQ6vfVuYcSGw /Ba3tMF3FpUTTEJh79qAoxdjTWRkWdnZiAU+NtpOL04/QrnTkarSRupbXd2NXzQizxWuprGGT0OKM Sq2xHke2iPOuTo4naNobGvUQZ86i9vr6BgWNr+5OSYN0FtxB2SEx1y7x+viOTB0uxJT1aFcECYlMJ 2qBhlySnANP5el9ivx/+5AcjF0MMmWY06kLiP352/kcFfHgpbZ4DKQOX7eOTdyh5i7bu1ScRuUyH+ Q5wSaIwRbcJnEgF0cklri5/Cxfi2PBGW/ntZexR+a5HNBjpP18BAJ1lbUCm8MdNhPDuO3Oo/eCGLj MUJcpJkC+A2yBfz7RZ8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfWje-00BpAg-9b; Sat, 16 Apr 2022 00:56:22 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nfWja-00BpAM-H8 for linux-arm-kernel@lists.infradead.org; Sat, 16 Apr 2022 00:56:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650070577; 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=3hb96ojkoLw7AMiZ7GVNm8rfGhRjOoCkHeqA5a/3O9g=; b=VvbDkfGRmr7ns9XNgvwC/lwj0iExTewKCb4RajWnbiQuXCRHHi38hyo32/zGAjZVmztT8b 99BqVWyeMGcqab75ZO/iC3xbxMQUx+p8Vr/97LxvBco0vmZZGUHGrmJwr8ulbgzhzi4Q6G yaZrKFabR1f36T6s7SBRci4hK/cODvQ= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-2riBdieJNXSKWYj-yf5OKg-1; Fri, 15 Apr 2022 20:56:15 -0400 X-MC-Unique: 2riBdieJNXSKWYj-yf5OKg-1 Received: by mail-qt1-f197.google.com with SMTP id v14-20020ac8748e000000b002ed0d38283aso6121596qtq.5 for ; Fri, 15 Apr 2022 17:56:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3hb96ojkoLw7AMiZ7GVNm8rfGhRjOoCkHeqA5a/3O9g=; b=026PgCU3gErQ72YtCXFNl+kosOSHHKxgmuOOtZbWCbAHWLTxqqmwWDUcyk8D8RsL6k xhObs2VtxwXNj7OO8AvHsau3OMD4d1zhvaYbUjfr+1dWiOSmSCDzTgHFSTen4v7wjsC1 0H1AAx56ifs64WlNTx/CB4EauivMe6QQDNIpOqe5dbjDuEfDG1MBLEe1vAxawsCIW1qt iLZdJf55rCjuO3Br8lT5a+A5ZdVex/V3qg3+F5e4DJt36LQ3csJO4S+PT6thu5OM5HE3 EzZhEuVryed037GI+JilP29KAHzvBAOBqyXO/HWg4BjGqQ2OLAtj1ot42kDqIa3F7O/h HCfQ== X-Gm-Message-State: AOAM5339f6pN7TeB2lrSU+MFZUCrMd3V1a91AU6Qh2NsO/4RWXLCrzaK PoZdwfK1AO2kEf7C3KHY7TxRr/UhH7aHZoJY60gkXRsRm6WyRIqIdnCZtq65awMebLCbIu0+QyS 8w8LgmByQxIhM7khYAYJCS4aAhf1uidxyEU0= X-Received: by 2002:a05:622a:1f8c:b0:2ef:9ec3:e176 with SMTP id cb12-20020a05622a1f8c00b002ef9ec3e176mr1098484qtb.39.1650070575501; Fri, 15 Apr 2022 17:56:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyW8eq6CVpC4t7+D5RwWQ2Sr5wdDGnmiP1wm3b/X7cOpvlUCwWtVvnTzG1xXkamMQoqom5Bg== X-Received: by 2002:a05:622a:1f8c:b0:2ef:9ec3:e176 with SMTP id cb12-20020a05622a1f8c00b002ef9ec3e176mr1098430qtb.39.1650070573290; Fri, 15 Apr 2022 17:56:13 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::45]) by smtp.gmail.com with ESMTPSA id i23-20020a05620a145700b0069c4e3b9c1dsm3170445qkl.46.2022.04.15.17.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:56:12 -0700 (PDT) Date: Fri, 15 Apr 2022 17:56:09 -0700 From: Josh Poimboeuf To: Chen Zhongjin Cc: "Madhavan T. Venkataraman" , mark.rutland@arm.com, broonie@kernel.org, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v1 0/9] arm64: livepatch: Use DWARF Call Frame Information for frame pointer validation Message-ID: <20220416005609.3znhltjlhpg475ff@treble> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220407202518.19780-1-madvenka@linux.microsoft.com> <20220408002147.pk7clzruj6sawj7z@treble> <15a22f4b-f04a-15e1-8f54-5b3147d8df7d@linux.microsoft.com> <35c99466-9024-a7fd-9632-5d21b3e558f7@huawei.com> MIME-Version: 1.0 In-Reply-To: <35c99466-9024-a7fd-9632-5d21b3e558f7@huawei.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jpoimboe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220415_175618_682797_C0A3897E X-CRM114-Status: GOOD ( 14.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 12, 2022 at 04:32:22PM +0800, Chen Zhongjin wrote: > By the way, I was thinking about a corner case, because arm64 CALL > instruction won't push LR onto stack atomically as x86. Before push LR, FP > to save frame there still can be some instructions such as bti, paciasp. If > an irq happens here, the stack frame is not constructed so the FP unwinder > will omit this function and provides a wrong stack trace to livepatch. > > It's just a guess and I have not built the test case. But I think it's a > defect on arm64 that FP unwinder can't work properly on prologue and > epilogue. Do you have any idea about this? x86 has similar issues with frame pointers, if for example preemption or page fault exception occurs in a leaf function, or in a function prologue or epilogue, before or after the frame pointer setup. This issue is solved by the "reliable" unwinder which detects irqs/exceptions on the stack and reports the stack as unreliable. -- Josh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF554C4332F for ; Sat, 16 Apr 2022 02:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbiDPCQE (ORCPT ); Fri, 15 Apr 2022 22:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbiDPCPb (ORCPT ); Fri, 15 Apr 2022 22:15:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90211F47E5 for ; Fri, 15 Apr 2022 19:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650075129; 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=3hb96ojkoLw7AMiZ7GVNm8rfGhRjOoCkHeqA5a/3O9g=; b=DyBt33JktCRpZ9x1c+yMTicN0DtU+NBqWmVhLWev59BKrfRq7hZrFdZqfGnLPu9qN+PAyH OPE0lbvb9bhdWuW2oP/4iOmHgmc/Ijn3h6sMz0HaPZwL3UIKNCE92/BdmE7d8T1SfV+ew8 zqBGAhlSG5o0ni+IGc3auo1jASizDDo= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-Spu3XCRTOlWUDdLE63H-ZQ-1; Fri, 15 Apr 2022 20:56:14 -0400 X-MC-Unique: Spu3XCRTOlWUDdLE63H-ZQ-1 Received: by mail-qk1-f199.google.com with SMTP id c8-20020a05620a268800b0069c0f1b3206so6482880qkp.18 for ; Fri, 15 Apr 2022 17:56:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3hb96ojkoLw7AMiZ7GVNm8rfGhRjOoCkHeqA5a/3O9g=; b=NJVXLbO7ZDLQy+jqqhccYdwauOgPuCN7MReftcT6t/4VzqzWwIGfro0nyQxiPGQtle +uHVcAvifWTzChtFvSIneldfcrfv2oVuBpXdKDmnzPdFdTVKYR73gtksXOCjmfjR86jO I4TttvutDHfzvQ07PSK1Grz7r7/7c+xo03ucbDQSVVNrO6v6omMimqYyU33ks6tIuyzZ fx0SsgGJEDBnKWCTgZFygUCK3BhIAHmfNmXY421X7YKzqKo1xKuWj4LZ6ETks2k/QYYw fpIvTlDz3WUuiFkbzdc3YoYDahl/uhEOqU8Ww027cx97REuHALSt8Pk1n3kL3wgOUIHe gmkQ== X-Gm-Message-State: AOAM5313VQRdv8girhNOA8KQ3n0JuG6rFwNqKFoo4Lay7jRl7e8jdSVP xMyPw8WlGqFamOl3P8orcRz3yxKira5pMX37bZk33WYqJJ2u2tH7lGo+Otoj3rEnDlRTWLVi2BN ymtQ6fvQPkd7jCfOA+vKpjnAt X-Received: by 2002:a05:622a:1f8c:b0:2ef:9ec3:e176 with SMTP id cb12-20020a05622a1f8c00b002ef9ec3e176mr1098434qtb.39.1650070573506; Fri, 15 Apr 2022 17:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyW8eq6CVpC4t7+D5RwWQ2Sr5wdDGnmiP1wm3b/X7cOpvlUCwWtVvnTzG1xXkamMQoqom5Bg== X-Received: by 2002:a05:622a:1f8c:b0:2ef:9ec3:e176 with SMTP id cb12-20020a05622a1f8c00b002ef9ec3e176mr1098430qtb.39.1650070573290; Fri, 15 Apr 2022 17:56:13 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::45]) by smtp.gmail.com with ESMTPSA id i23-20020a05620a145700b0069c4e3b9c1dsm3170445qkl.46.2022.04.15.17.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:56:12 -0700 (PDT) Date: Fri, 15 Apr 2022 17:56:09 -0700 From: Josh Poimboeuf To: Chen Zhongjin Cc: "Madhavan T. Venkataraman" , mark.rutland@arm.com, broonie@kernel.org, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v1 0/9] arm64: livepatch: Use DWARF Call Frame Information for frame pointer validation Message-ID: <20220416005609.3znhltjlhpg475ff@treble> References: <95691cae4f4504f33d0fc9075541b1e7deefe96f> <20220407202518.19780-1-madvenka@linux.microsoft.com> <20220408002147.pk7clzruj6sawj7z@treble> <15a22f4b-f04a-15e1-8f54-5b3147d8df7d@linux.microsoft.com> <35c99466-9024-a7fd-9632-5d21b3e558f7@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <35c99466-9024-a7fd-9632-5d21b3e558f7@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 12, 2022 at 04:32:22PM +0800, Chen Zhongjin wrote: > By the way, I was thinking about a corner case, because arm64 CALL > instruction won't push LR onto stack atomically as x86. Before push LR, FP > to save frame there still can be some instructions such as bti, paciasp. If > an irq happens here, the stack frame is not constructed so the FP unwinder > will omit this function and provides a wrong stack trace to livepatch. > > It's just a guess and I have not built the test case. But I think it's a > defect on arm64 that FP unwinder can't work properly on prologue and > epilogue. Do you have any idea about this? x86 has similar issues with frame pointers, if for example preemption or page fault exception occurs in a leaf function, or in a function prologue or epilogue, before or after the frame pointer setup. This issue is solved by the "reliable" unwinder which detects irqs/exceptions on the stack and reports the stack as unreliable. -- Josh