From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) (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 A3D0F185E73 for ; Thu, 8 Aug 2024 07:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723100428; cv=none; b=UrsHfgnwqJsfGUHAaMXPDGQQg2QeCSHwy4tJMmQkgRL47xubGIWAg9kcFbhq2DH1bm7aW2Fxh1FB5PsmyT0nZIR/NB+NOQqpn5+i7/DNMenmM0E8HM7YAyiCRavQYbeG3xTTuOempGK8JZvuimOJh+PASubZ87UXZQ6I7c39XbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723100428; c=relaxed/simple; bh=5OlsLIs23Nw7JUsJjh4Fv1EMhb9ogWG3DeDeNx7OwvY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TkQbJj1phu1BmNtF2gnQggAssTIJqDUMARVK0nRH1pzll//77FBgxMZ20mRXMNInpMz3BZGtuvewopnmK/ZBp0MUJASA75lnwFWPlqBhHRREL3ZmKVgkQVg4AapeY0FnSaCf6ZD0BoVbs4+IDEb0aSHh/rG4+1sEe62WF+zZNNU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WfdGZ54Sqz9sPd; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FF_P4QsPbfUQ; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WfdGZ4BYXz9rvV; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7FC298B76C; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id OS09V1Nd9zN9; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) Received: from [192.168.234.168] (unknown [192.168.234.168]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0259A8B763; Thu, 8 Aug 2024 09:00:21 +0200 (CEST) Message-ID: <79fffe34-ce0b-4937-a85a-0ce566684887@csgroup.eu> Date: Thu, 8 Aug 2024 09:00:21 +0200 Precedence: bulk X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] powerpc/ftrace: restore r2 to caller's stack on livepatch sibling call To: Ryan Sullivan , live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: joe.lawrence@redhat.com, pmladek@suse.com, mbenes@suse.cz, jikos@kernel.org, jpoimboe@kernel.org, naveen.n.rao@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com References: <20240724183321.9195-1-rysulliv@redhat.com> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: <20240724183321.9195-1-rysulliv@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 24/07/2024 à 20:33, Ryan Sullivan a écrit : > [Vous ne recevez pas souvent de courriers de rysulliv@redhat.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > Currently, on PowerPC machines, sibling calls in livepatched functions > cause the stack to be corrupted and are thus not supported by tools > such as kpatch. Below is an example stack frame showing one such > currupted stacks: > > RHEL-7.6: Linux 3.10.0 ppc64le > ... > > This is caused by the toc stub generated on a sibling call: > ... > > This patch restores r2 value to caller's stack, on a sibling call this > will uncorrupt the caller's stack and otherwise will be redundant. Be carefull. On powerpc/32, r2 contains the pointer to current struct. When I first read the subject of the patch I was puzzled. You should say toc instead of r2, or make it explicit in the title that it is for powerpc/64 Christophe 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 61975C52D7B for ; Thu, 8 Aug 2024 07:00:54 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WfdH85QJ4z3dLW for ; Thu, 8 Aug 2024 17:00:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.235.10; helo=pegase2.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=lists.ozlabs.org) Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 4WfdGk1RYhz3d8M for ; Thu, 8 Aug 2024 17:00:28 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WfdGZ54Sqz9sPd; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FF_P4QsPbfUQ; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WfdGZ4BYXz9rvV; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7FC298B76C; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id OS09V1Nd9zN9; Thu, 8 Aug 2024 09:00:22 +0200 (CEST) Received: from [192.168.234.168] (unknown [192.168.234.168]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0259A8B763; Thu, 8 Aug 2024 09:00:21 +0200 (CEST) Message-ID: <79fffe34-ce0b-4937-a85a-0ce566684887@csgroup.eu> Date: Thu, 8 Aug 2024 09:00:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] powerpc/ftrace: restore r2 to caller's stack on livepatch sibling call To: Ryan Sullivan , live-patching@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <20240724183321.9195-1-rysulliv@redhat.com> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: <20240724183321.9195-1-rysulliv@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: pmladek@suse.com, joe.lawrence@redhat.com, jikos@kernel.org, npiggin@gmail.com, naveen.n.rao@linux.ibm.com, mbenes@suse.cz, jpoimboe@kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le 24/07/2024 à 20:33, Ryan Sullivan a écrit : > [Vous ne recevez pas souvent de courriers de rysulliv@redhat.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > Currently, on PowerPC machines, sibling calls in livepatched functions > cause the stack to be corrupted and are thus not supported by tools > such as kpatch. Below is an example stack frame showing one such > currupted stacks: > > RHEL-7.6: Linux 3.10.0 ppc64le > ... > > This is caused by the toc stub generated on a sibling call: > ... > > This patch restores r2 value to caller's stack, on a sibling call this > will uncorrupt the caller's stack and otherwise will be redundant. Be carefull. On powerpc/32, r2 contains the pointer to current struct. When I first read the subject of the patch I was puzzled. You should say toc instead of r2, or make it explicit in the title that it is for powerpc/64 Christophe