Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2122448imu; Sat, 12 Jan 2019 16:20:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN70ergptrh6SxceVzbDfMMPw1gjhVzALJQ94EJCZEMM7btRM7cWZRltaARQG3Gn38qfY0Qw X-Received: by 2002:a63:d655:: with SMTP id d21mr8174131pgj.280.1547338853107; Sat, 12 Jan 2019 16:20:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547338853; cv=none; d=google.com; s=arc-20160816; b=Mqht5g1WsJrAu9lxqWUlMjitjVFs6JCAOXmyJU8pc2HUDGxLEEvfU0rlo39xUkVZB1 MWmSgSEUyTiqBr1X3nt2LNPriR1Xngb5UBL4t8wQLqCw8TOtuJI2KjfU84NK+JmakW+F OFAyZv9dP0EjcMNtCT1J+XD6ySr3YMFSVq4H9XdEsco1P5MdjnYKOzO6JM9FKlqUtNSD r8tdkKzYxqAjj/WGJm12ngewkfy6rgkssX1zLKKzyISavCntf5xrK1tXQTGVw2ysUsrT dGHC+7VdI930OHhQcsbDb2U6xbw+RTWohhxD0LU0TGt1+8My6bF9ujTF5n2U5Q4lC7Du 0BDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AdkZAnRxw6pJ0k0zFmfHNxsv1ODMM8XPyhGSlel1u2U=; b=Sy5hY/szg/diOz0Wv8374T9Gij2pg9hoMxZ4FGwmMXe+C0ywJ1mLp9NEmrtqAdr2L9 /0VxmTKM8p6FYItF/8c68C5fmv3bKTZVcWpYYx5cg8iBCP2vpagrGuGuyf4vgk7nABrz clmF/Nf81jpMr/GiIA3hCrene4cWb+0eMC4GB7hA9FwXDODvSZ7qD/P4g+czmRVZHq9f tFgYcj/5AsvcqVfPQTXc0AjoS4CQYUTwE0/8u3dhfzz/xzaPkaYpPkramrtjmxU+dzOR x6LOY19X6Fob9limWwRs++AMNkuw0vyWE/0FZxajSIOGPj1uVzZkdUtNCs3AqJcDU0HF rEyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mtIUJO8W; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f63si39063123pgc.473.2019.01.12.16.20.36; Sat, 12 Jan 2019 16:20:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=mtIUJO8W; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726515AbfALXyi (ORCPT + 99 others); Sat, 12 Jan 2019 18:54:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:48092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbfALXyh (ORCPT ); Sat, 12 Jan 2019 18:54:37 -0500 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A9DD22133F for ; Sat, 12 Jan 2019 23:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547337276; bh=t0r0aXUvIl8mMcbhKbl3RlhOozK/J15cc2VqQbgLfAg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mtIUJO8WuCITsn53lljn42bB+ycg0IxLKMfZIK8BEkX6l+4IFLI1NnXRr3Vo7aPUW GbCMJ6KhpQruIBEKMU3eYJo/5ps0IRByQ0hrO0eMHeKa0EWN9OGpt6xc52Gw4qanpV U32khLctJQh1/FYtskqWbwVqKieYNN9s4QtnIuVk= Received: by mail-wm1-f41.google.com with SMTP id y8so5552874wmi.4 for ; Sat, 12 Jan 2019 15:54:36 -0800 (PST) X-Gm-Message-State: AJcUuke/DshnF3BVDOqRp3orTG7M8gLFTMZ77dfF75dHYK6UJBoFIwCw ojDBFe9StUzKVZXm6xc4riFwLHeIL7nNyHvPw+pavQ== X-Received: by 2002:a1c:864f:: with SMTP id i76mr6782839wmd.83.1547337275055; Sat, 12 Jan 2019 15:54:35 -0800 (PST) MIME-Version: 1.0 References: <20190110205226.iburt6mrddsxnjpk@treble> <20190111151525.tf7lhuycyyvjjxez@treble> <20190111200420.qtyffayxceysoarf@treble> <20190111203135.5clurevf34bkiy3o@treble> <20190111212210.veyfn5vvjswcwacm@treble> In-Reply-To: <20190111212210.veyfn5vvjswcwacm@treble> From: Andy Lutomirski Date: Sat, 12 Jan 2019 15:54:22 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 0/6] Static calls To: Josh Poimboeuf Cc: Linus Torvalds , Nadav Amit , Andy Lutomirski , Peter Zijlstra , "the arch/x86 maintainers" , Linux List Kernel Mailing , Ard Biesheuvel , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 11, 2019 at 1:22 PM Josh Poimboeuf wrote: > > On Fri, Jan 11, 2019 at 12:46:39PM -0800, Linus Torvalds wrote: > > On Fri, Jan 11, 2019 at 12:31 PM Josh Poimboeuf wrote: > > > > > > I was referring to the fact that a single static call key update will > > > usually result in patching multiple call sites. But you're right, it's > > > only 1-2 trampolines per text_poke_bp() invocation. Though eventually > > > we may want to batch all the writes like what Daniel has proposed for > > > jump labels, to reduce IPIs. > > > > Yeah, my suggestion doesn't allow for batching, since it would > > basically generate one trampoline for every rewritten instruction. > > As Andy said, I think batching would still be possible, it's just that > we'd have to create multiple trampolines at a time. > > Or... we could do a hybrid approach: create a single custom trampoline > which has the call destination patched in, but put the return address in > %rax -- which is always clobbered, even for callee-saved PV ops. Like: > One think I particularly like about the current design is that there are no requirements at all on the calling convention. I think it seems fragile to add a calling convention constraint that only applies when there's a race. I'd rather do a longjmp-like hack or a stack gap adding hack than make the actual static calls more fragile.