Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1980782pxb; Mon, 23 Aug 2021 09:07:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLc+Rrchpz7A7gpUq6LydlHDn+QKvJcOV1FTGpnhgIxuiAEaDAEB75GDWotiBbjjTxG40s X-Received: by 2002:a92:c90a:: with SMTP id t10mr24514022ilp.188.1629734865437; Mon, 23 Aug 2021 09:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629734865; cv=none; d=google.com; s=arc-20160816; b=CPkNwTOXl1vUh7JxKYKQltQydX30pBCTE6kcxgclBvrDeazj2Qb2Yax2/0dti+b0cv 6ADEFsOMZSLKZ4AYM2Pk3S568BFy/pO7hvSQcE96a74JGFbcSkLVw2p7g86Sq1VGPlLb 7RHvaG5uN5rB0qa4phnJtpTCO9hvgoL4Gv93/12bu21TGe3k+mR/l9qtdg0qbKV4I+zr jMU5/oRCbqb1JOIT974yANVaRSrV73ZGyNxC59Sju/Uy7rl6hRYyyMMrIeEdKeESkfHl 3l8qYKERlFeWMgdd8rXlw3fbKAlFbMxc70fK8G54un53QFoEkOCEsBd3i3nlzxypqQeY K3yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=zfRfYfYjq0A7dSkgPh7AeerydIfcUdh/vsZId61fVHI=; b=Rhh9BoRRb3n1rWOz2C4Jl0zBqvdx5XScCmDxA93K6zry4Wq1a97JbIhGzNvDw9PfLP KDyTVAOf2l+ZJ0M40KHcQ0ASu70p2nRCaFsmIROGPkPcBMq2UUh/uMv/nh9V2iHgaQnU +7O9VTP76QgKV/UL6MIHsFsSSIGJ8Ru+j6Lq/+rKoc8NrpQ1tyFXW/INh2rUGN5TWhl5 CGaqJjKjbFK/UmaZo5cUW+BbyOTiPMcZftOXqlvOdhlKY+BpXvSinVWUcurblESaT+Pz tM0UwCAb+g20jXEYa5ob0NMaY31RFZjehHDTERgLkrklfLR0tV2zVTZU9imoJVLURc5g C0Sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si16177078ili.39.2021.08.23.09.07.33; Mon, 23 Aug 2021 09:07:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbhHWQF3 (ORCPT + 99 others); Mon, 23 Aug 2021 12:05:29 -0400 Received: from gate.crashing.org ([63.228.1.57]:54339 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbhHWQF2 (ORCPT ); Mon, 23 Aug 2021 12:05:28 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 17NFwj45016805; Mon, 23 Aug 2021 10:58:45 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 17NFwbGZ016793; Mon, 23 Aug 2021 10:58:37 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 23 Aug 2021 10:58:37 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/booke: Avoid link stack corruption in several places Message-ID: <20210823155837.GX1583@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 07:53:01AM +0000, Christophe Leroy wrote: > /* Be careful, this will clobber the lr register. */ > #define LOAD_REG_ADDR_PIC(reg, name) \ > - bl 0f; \ > + bcl 20,31,0f \ > 0: mflr reg; \ > addis reg,reg,(name - 0b)@ha; \ > addi reg,reg,(name - 0b)@l; The code ended each line with a semicolon before, for absolutely no reason that I can see, but still. Fixing that would be nice, but only doing it on one line isn't good. Btw. Both the 7450 and the modern cores implementing this really need this to be $+4, so it is a lot clearer to write that instead of 1f or a named label. Segher