Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp948766ybb; Wed, 25 Mar 2020 12:37:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt7eXtTUpfRKQFkXE3eiXkFKgPi6PXAJ0cdSgg0Y0zbflgRKuTIxRf+rwZJYimLc3rRzS+j X-Received: by 2002:a9d:644a:: with SMTP id m10mr3645705otl.207.1585165069259; Wed, 25 Mar 2020 12:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585165069; cv=none; d=google.com; s=arc-20160816; b=ycxjIU93aV7OLrR6Dd/t2sMYzp8VwAIcIf1jbA2iF46O0z6oLTLQVUCY3vqjOBILcd l+wd4G94sZxz9u+FRAIQ9Titd2P6sDTU4cfpqf6jiBvPh1FDYOEfdjFKhnSnFAFk+CUv bNBRzUqEBrA4NhdX83MhdlV3JZ3ERYB1GakT5K/6BKpbYRi7M1LNUNEPNQxyh/7XOifg PyQrRFlMUXgzJaaaCzzF8H91EzxThXwrUYqS9Bhttj9sir/PkhSBE3YpWqLrq8yuAzqt 4DLstT0WGxuD3q8p06u+Ajz3KGOEIvSJ1Lwwh6vPcz3nz/6jzfe/AQ29gV3IUd6eAml6 Lq8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:dkim-filter; bh=p0YpVfwC+aoOZ4NgH84gzFe9XflqvVIEwlLHk9I94xA=; b=loXf3ZMBVjaWY3RmswQxskfHsxN1xaSo+Hy+PqdjhHy0o2dKflRcaeVJbx0wm9lkWo HsPQPDkPkWxQrdZo4+FaITQ4KRqUE1s+mL8PI6Rwhbcac0d9OEkautiTT1+r/k4kstzQ KLLTy75tSEoFE10BYB5euspzuCAR9Vf/Nq+cO25Gk5MoxMffnGNWKDqtC10iZXvNTHpM iZJAEsiOmosr2pJ1FVTWT1iZUvuC1p0RF4BifuIgskPVYb2oXe2QcbtKP+/yVAMp2YfC BEiFipvaRu/VAMbUtBbPWlZBJzMq4U9ugVYj8bByqeMW1aodrMr+m0uREyuK7l6vt27B bdow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020032201 header.b=e8AX+oNZ; 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=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si22728otj.252.2020.03.25.12.37.34; Wed, 25 Mar 2020 12:37:49 -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=fail header.i=@zytor.com header.s=2020032201 header.b=e8AX+oNZ; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727830AbgCYTfd (ORCPT + 99 others); Wed, 25 Mar 2020 15:35:33 -0400 Received: from terminus.zytor.com ([198.137.202.136]:34647 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727281AbgCYTfc (ORCPT ); Wed, 25 Mar 2020 15:35:32 -0400 Received: from [IPv6:2601:646:8600:3281:c898:2a71:8b3c:1618] ([IPv6:2601:646:8600:3281:c898:2a71:8b3c:1618]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 02PJYkiZ3555937 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 25 Mar 2020 12:34:49 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 02PJYkiZ3555937 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020032201; t=1585164890; bh=p0YpVfwC+aoOZ4NgH84gzFe9XflqvVIEwlLHk9I94xA=; h=Date:In-Reply-To:References:Subject:To:CC:From:From; b=e8AX+oNZ3XoGngvL1o9eHvVCjpXknqO1c5smzu6gqK+9OZm9gKkng3M7x6ndALLgW y8RECtMR8Jg3FI1QsnLC+eGpt8yoSPqTJ+DKnJj9VhtXkGRvpR8CAxIyPvkPvjXFKm LrNsjOTu0OVkCl1lHUu3h6t840jrpGXNcx/LMG3pT1QPRCrUdG9w7fwSNR5De/Feqx 4D65DGdOjZUxOKNWsCm+vJakJul8P5LEyFBzgNK77GYt/ad5VWpDDD+ziIFlzYwYsy 0/gjVTeIB+JcQmgvjmQ6HexUR1rEj3rlXj0FHGmcth1fGLC6i9cKlcYGLtkWGX5PtN diHHRYlzCLJzw== Date: Wed, 25 Mar 2020 12:34:38 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: <86D80EA7-9087-4042-8119-12DD5FCEAA87@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [RESEND][PATCH v3 14/17] static_call: Add static_cond_call() To: Linus Torvalds , Andy Lutomirski CC: Peter Zijlstra , the arch/x86 maintainers , Linux Kernel Mailing List , Steven Rostedt , Masami Hiramatsu , Daniel Bristot de Oliveira , Jason Baron , Thomas Gleixner , Ingo Molnar , Nadav Amit , Andrew Lutomirski , Ard Biesheuvel , Josh Poimboeuf From: hpa@zytor.com Message-ID: <59FDEFC1-9353-453F-84E5-F94995157B27@zytor.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On March 24, 2020 9:33:21 AM PDT, Linus Torvalds wrote: >On Tue, Mar 24, 2020 at 9:22 AM Andy Lutomirski >wrote: >> >> I haven=E2=80=99t checked if static calls currently support return valu= es, >but >> the conditional case only makes sense for functions that return void=2E >> >> Aside from that, it might be nice for passing NULL in to warn or bug >> when the NULL pointer is stored instead of silently NOPping out the >> call in cases where having a real implementation isn=E2=80=99t optional= =2E > >Both good points=2E I take back my question=2E > >And it aside from warning about passing in NULL then it doesn't work, >I wonder if we could warn - at build time - when then using the COND >version with a function that doesn't return void? > >Of course, one alternative is to just say "instead of using NOP, use >'xorl %eax,%eax'", and then we'd have the rule that a NULL conditional >function returns zero (or NULL)=2E > >I _think_ a "xorl %eax,%eax ; retq" is just three bytes and would fit >in the tailcall slot too=2E > > Linus "movl $0,%eax" is five bytes, the same length as a call=2E Doesn't work fo= r a tailcall, still, although if the sequence: jmp tailcall retq =2E=2E=2E can be generated at the tailcall site then the jmp can get patch= ed out=2E This would be equivalent to disabling tailcalls except that the stack fram= e is normally not unwound until between the call and the ret, so just disab= ling tailcalls from the compiler pov doesn't work=2E --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E