Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp213147ybb; Fri, 3 Apr 2020 01:02:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKwJKVNeFMdIBxYSUNWsPZhuZ6Pqk6Sh4/2W2b9HI5dezbkrZN72axT5CYhHtTzJ0r8Txtk X-Received: by 2002:a9d:798f:: with SMTP id h15mr5486822otm.284.1585900940246; Fri, 03 Apr 2020 01:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585900940; cv=none; d=google.com; s=arc-20160816; b=F6SGNznzIs8eX8pBVRfHOgk9UW2yKP5dcg2ZOScOhHGyC0L2HMfWz+YMlV8Xcwl16M wtt/eCoiDZQmSjO1VnlLZuCAFxb4vg84cuii3UnXg5lQXQJqKSE/U/I5IPLSsssD6oy/ rTvc9X55MpmwmB5MyrEU6bX8h6LBAac0NgR+TUzsL5/kcWSU3UZvgM/zYe8OVI24sH4Y dxSrNyzdLbRCxwc74iuC+EeK5AwH54C70KMwlxJfY6FAkZSsLBBeWozv6IqbzZrPt59R wmuBIxNWir1lEIvIV4EIFx4AeemzUZnpfCzb31a+ErFfqqByh4hxoLIsFCvFwQTTm0k7 R1Eg== 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:dkim-signature; bh=t0lsX/x9+PyHMjEl9oBBvGBVzDFKOmYTP+L6m59O3mk=; b=umVJGgHgJCUVfEZUBymfcQS4PeXmMnPlqPefk5FFBIl++tlK8AvTwofhQ7fKBRmTYc DKUQ3kDwxGYgpuIPaJmMJWHKSKryRL21O/3AEtwpMKHx3pXgGyg6p3w5pFyd55MXHGIp 3xQZR0Ey3W0FXQgvU6gCQM32YNqT13Y3P1hBrQFZcghgDYuXbf4BeuFyyO6HCJIC1NAn HqMMadJZjV0EkfQ0OZCVNX4h4byX6v2Ra+55D4kIQElBi4r2gnvylO7m+pfsZU7IErAB i17Gx1l5//807nVme0rES+RNeitX8GYw7EI/r/1BbM66jAOtdjK5gyjwYdeNPVEeX3yY e0QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dsTA2xtz; 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=pass (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 u10si3310975oib.91.2020.04.03.01.02.07; Fri, 03 Apr 2020 01:02:20 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dsTA2xtz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388608AbgDCIBr (ORCPT + 99 others); Fri, 3 Apr 2020 04:01:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:60129 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727431AbgDCIBr (ORCPT ); Fri, 3 Apr 2020 04:01:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585900906; 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=t0lsX/x9+PyHMjEl9oBBvGBVzDFKOmYTP+L6m59O3mk=; b=dsTA2xtzHAe1pnKcVxnW/MyEX+nnZG75It+mst4S2Gvj+RMtw/uwoBZO8/4jviUoDWW5di kCbmGMV5xozCILGWPCoI/IyotPV7bD48I9nBjUa+TxtJ+YZQYLH+J9zWD5cFztg0LQIHzZ 9Uk+fZoF6MA7LnQbBEfWt6eWLHWtyp8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-93-YHeymKviMRy45qvE9OcUrg-1; Fri, 03 Apr 2020 04:01:41 -0400 X-MC-Unique: YHeymKviMRy45qvE9OcUrg-1 Received: by mail-wr1-f69.google.com with SMTP id l17so2705063wro.3 for ; Fri, 03 Apr 2020 01:01:41 -0700 (PDT) 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=t0lsX/x9+PyHMjEl9oBBvGBVzDFKOmYTP+L6m59O3mk=; b=cGI+i2qIx9QXP13nj6o8v5+G4barXzQjEWckxiQYbih08tF8eMYdlag4aZxa4o0Pxx 1fKtkdWOHXEWk+qGxou+exz4d5pCWe2fOo5hpb9g0QvOHwTfj0aIK5sDKZbK8m0r4KVj ED7jMixslKwBX5BTCUc1ynoPMKTjUmt3qESAL9qwQAS/7zdvovx9awGXKcTGOs4nLVsS hjuc5x/7cKnNobUgsKPnOsJfYYtQ+qDjdnGms93UJs8S/5iwK5rTFUlhpuvtQ+FB9N0Y 2I9CodVKzNAgRYzaBwFAUJwK7sbO9HXSC/5EpOP4hElWn1jOqer/2+7feSXtLEuvOYix bR3g== X-Gm-Message-State: AGi0PuYdE12hneG4KCzRfnbO93EpNHFiap2m7KMqKWikRUwndSXP45zr jVWNx3ti1MsmeziDZ0G/QsHkAmnpvjoXIVqylGheiz0TAdt+MU9bpSqC18vXFIwFFWjDPL2HvBO VVnTfklfvSHqQHc6T7IsKABKT X-Received: by 2002:a1c:ac8a:: with SMTP id v132mr7102695wme.62.1585900900726; Fri, 03 Apr 2020 01:01:40 -0700 (PDT) X-Received: by 2002:a1c:ac8a:: with SMTP id v132mr7102673wme.62.1585900900503; Fri, 03 Apr 2020 01:01:40 -0700 (PDT) Received: from ?IPv6:2a01:cb14:58d:8400:ecf6:58e2:9c06:a308? ([2a01:cb14:58d:8400:ecf6:58e2:9c06:a308]) by smtp.gmail.com with ESMTPSA id w67sm10653663wmb.41.2020.04.03.01.01.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Apr 2020 01:01:39 -0700 (PDT) Subject: Re: [PATCH 3/7] objtool: Add support for intra-function calls To: Josh Poimboeuf Cc: Alexandre Chartre , x86@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de References: <20200402082220.808-1-alexandre.chartre@oracle.com> <20200402082220.808-4-alexandre.chartre@oracle.com> <20200402154919.2c6shw4hfreagchg@treble> From: Julien Thierry Message-ID: <3d075cb2-8d99-5ab7-4842-efef1964247d@redhat.com> Date: Fri, 3 Apr 2020 09:01:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200402154919.2c6shw4hfreagchg@treble> 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 4/2/20 4:49 PM, Josh Poimboeuf wrote: > On Thu, Apr 02, 2020 at 01:53:49PM +0100, Julien Thierry wrote: >> Hi Alexandre, >> >> I ran into the limitation of intra-function call for the arm64 support but >> didn't take the time to make a clean patch to support them properly. > > Can you give an example of where arm64 uses intra-function calls? It > sounds sketchy to me :-) Is it really needed/useful? > So the most notable/necessary one(s) is the one in tramp_ventry [1]. This macro is used as the begining of exception handlers for exceptions coming from userland. It was added as part of the mitigations of spectre (v1???). To give some context, x30 is the register that "ret" instruction will use as return address, "bl" is the equivalent of x86 "call" and sets x30 before jumping to the target address. (However, it doesn't have a special semantic for exception returns) Note: I believe the comment about the return "stack" is about processor internal state (speculative thingies and all) rather than the actual stack, since the stack is untouched by that code. But I don't know the actual details. There are also some in arch/arm64/crypto/crct10dif-ce-core.o , which is probably full of fast, smart and optimized code I don't understand :) . So I wouldn't feel confident commenting on whether those intra-function calls are needed or not. Last I found is in qcom_link_stack_sanitization() [2], but that's just a workaround for a very specific hardware. In my local tree I just put the function as STACK_FRAME_NON_STANDARD. But the code just saves the return address, has 16 call instructions that just call the instruction after them, restores the return address and lets the C-function return normally (and it somehow fixes something for that hardware). Those are the ones I stumbled on. So yes, it a bit sketchy, corner case code, but it's there and unlikely to go away. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/entry.S?h=v5.6#n803 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/cpu_errata.c?h=v5.6#n195 Cheers, -- Julien Thierry