Received: by 10.223.185.116 with SMTP id b49csp2315393wrg; Thu, 22 Feb 2018 11:40:07 -0800 (PST) X-Google-Smtp-Source: AH8x225vuC3Cw1xZKJTVv6x5h0MSGH1/5nedbirwN8m3N/fMxojZTX+/sVoHDpVJRvke237zd2y+ X-Received: by 10.99.55.65 with SMTP id g1mr6513096pgn.284.1519328407540; Thu, 22 Feb 2018 11:40:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519328407; cv=none; d=google.com; s=arc-20160816; b=JwKJ1sDjHzdCuDg7Gjv8UGa24sGf+iJ90bc+ufFK+9XNX7rmB7ibnyvLew9srtFjh5 JFaolIIRHNrkmZ8D8TzP1abj1k+SoRV243T9bITl9SY9p8Q5A6ZASKe1jB+7EuoJmCmo AlloutYqEj/pjn7VYoxxsDG/diKZuZgcaONHxuVO5TIxapjSdJbr2DisblSAi0vKzQa1 OtDQ20JL2fXt4C97MxX/EiucgQ6SSWBQbioSEEX1fO3v7WYzW8y04hXN257JwZaQDwEZ LoiRiJPSPkdZjgPeALFS7VBoc10OTmN/hqU+g6UQPI4oeewS4oqSGX8JmSAzh9kyQih/ qWDg== 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=HRhhWauvCZTaQnYVaRdacVqWy84eBsuPet5466dPEjA=; b=ggdKNNPIPop4tnC4bbhKDKa3keGQ5rGikV3hf4M+w86pB12K4BoKq8SWkXHzaKfu/0 +sTXcmyYD5df0h+rzaif46/lYsVzzDDz0Nsmx6IbXlUhRGcZ9U8rR6T9Xm3GUCLhmdOc CcSBzUa3f3EHoLFrgQ5h/5uZQ0kPzeAuZUAkkGVIdZ3PcO89tXxAQwLvmJxGLrvfXzAr CFoaBDLNeaMn+jTlB9EBD+OC41sdp1ZQ30OMJmIfSoznznPuzGnQzKX7kPFE58eKwH29 NGpeVK6Y3gvuBEZ2YpYMWVgsqqx/wmRLZ3klmvoRj0zgpS4nzOyro5dyBe+YkP2NB+xU AaAQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a189si381784pgc.123.2018.02.22.11.39.52; Thu, 22 Feb 2018 11:40:07 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbeBVTjE (ORCPT + 99 others); Thu, 22 Feb 2018 14:39:04 -0500 Received: from mail-ot0-f194.google.com ([74.125.82.194]:44023 "EHLO mail-ot0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbeBVTjD (ORCPT ); Thu, 22 Feb 2018 14:39:03 -0500 Received: by mail-ot0-f194.google.com with SMTP id q12so5676355otg.10 for ; Thu, 22 Feb 2018 11:39:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HRhhWauvCZTaQnYVaRdacVqWy84eBsuPet5466dPEjA=; b=H6puEJzakpozuEujjTiPBX3sYWVsTZogCFoDtOtLOFFE227c3sgSaXsSF8jYzV2uxp Hl/fzz9rvoZ29bGmjKlVUY5kiABcUbRbS5fsR6+PIcbRAOX+DNXa2Y4TrsvxvDPt01wD 7mwAH+0Q4DTuM7bqXa9WpwGNdBNMi7yIe2GAGYIcJcuQfV8UYvm6rMfSlUb2BX9DVGjK 6ZGc5XvFVv/TqDuZppr6TLZ28sGZNpD/dFM8vXioRXkWpwuIdIGCIGToblg4yO5IlkEC 27XaFXSFjshXNVEDlF0n5StZR8AUH7uvx1SnrOm/N5+HcCvNzqDcguReq/VXUEQPkYh6 jkUw== X-Gm-Message-State: APf1xPBzAeYHSqX7CQzjSyCQQqjVF+s3eCdoirrY0mkcP2tCEI75NLuF V6nN8BwL8sk6e/pyuGyvkh88SQ== X-Received: by 10.157.56.18 with SMTP id i18mr6341726otc.197.1519328342965; Thu, 22 Feb 2018 11:39:02 -0800 (PST) Received: from ?IPv6:2601:602:9802:a8dc::f21a? ([2601:602:9802:a8dc::f21a]) by smtp.gmail.com with ESMTPSA id 70sm358037oti.59.2018.02.22.11.38.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 11:39:01 -0800 (PST) Subject: Re: [PATCH 1/2] stackleak: Update for arm64 To: Will Deacon Cc: Alexander Popov , Kees Cook , Mark Rutland , Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com, richard.sandiford@arm.com References: <20180221011303.20392-1-labbott@redhat.com> <20180221011303.20392-2-labbott@redhat.com> <20180222165834.GC18421@arm.com> From: Laura Abbott Message-ID: Date: Thu, 22 Feb 2018 11:38:48 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180222165834.GC18421@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 On 02/22/2018 08:58 AM, Will Deacon wrote: > Hi Laura, > > On Tue, Feb 20, 2018 at 05:13:02PM -0800, Laura Abbott wrote: >> >> arm64 has another layer of indirection in the RTL. >> Account for this in the plugin. >> >> Signed-off-by: Laura Abbott >> --- >> scripts/gcc-plugins/stackleak_plugin.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c >> index 6fc991c98d8b..7dfaa027423f 100644 >> --- a/scripts/gcc-plugins/stackleak_plugin.c >> +++ b/scripts/gcc-plugins/stackleak_plugin.c >> @@ -244,6 +244,11 @@ static unsigned int stackleak_final_execute(void) >> * that insn. >> */ >> body = PATTERN(insn); >> + /* arm64 is different */ >> + if (GET_CODE(body) == PARALLEL) { >> + body = XEXP(body, 0); >> + body = XEXP(body, 0); >> + } > > Like most kernel developers, I don't know the first thing about GCC internals > so I asked our GCC team and Richard (CC'd) reckons this should be: > > if (GET_CODE(body) == PARALLEL) > body = XVECEXP(body, 0, 0); > > instead of the hunk above. Can you give that a go instead, please? > > Cheers, > > Will > Yep, seems to work fine and makes sense from my understanding of gcc internals. I'll fix it up for the next version. Thanks for the review! Laura