Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1015716imu; Fri, 11 Jan 2019 13:19:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6bKeKB//QlVz/yZeH0yE8sKBNPX5iDjltDef6fhlpHS/QiHDVAnMz0S+dwsMxNPzUeUeO/ X-Received: by 2002:a63:6b05:: with SMTP id g5mr14418984pgc.15.1547241591729; Fri, 11 Jan 2019 13:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547241591; cv=none; d=google.com; s=arc-20160816; b=HwyXVeuW9wZRDAbRU7NbrSQQov9CintJR1+eF0vXdzizClDguZ04/uYK9uHlDk/1Jv 3uVeW4jk1iPyvM4QCLgT9WDFqbmnkoVw2KAnOxCL0SxB2skoIhaW8iGzE/tZk+UYRQp1 dgEcxRSDIPeey+rDgJeiMjZNFo5Ck74O8eDDqVnAYlY7/gjfXPtR4oPPGnZoudT0EUR7 d7eNAWMNIw2xe3gWDcKiV2tRFjli8/dvYK2iKZJQenj9OjW8tvProhorrAtEMW+ckilc QucOjyjLSvvz9j5P+qduAJiGf0dsby+hdFUulYaiYO6h4pZsvTO7cH5fOLGmo0Lf7eMZ t8Vg== 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=Xiz1AmOzy/ByGNqNChkzXJ1iGhA9KMYgWTx3xlbkeA8=; b=0old6Q7V4ursCzRLo5DMRvkEGVFBFmAoXZJYN3MYwRIRa/s87SxvuTl5tdOnaUOGkG ulfxyCRiJkxwVAO73xVHtsjQpJHW2Y11c0SvGgkfjG02gldgiht1k2g9dsBBYMe5VThf y2oN6bh8duh1i9MNIu4ehDpJfTVSRiDQPiq37hyojTW2oXyxxVbeX1DYk+3zZHsstLvb UalIJhvGRvtFRD19D4sPmKYk2GR/Q7cp43vS52i3r9cH2dsF2d6hUIHogE9XC0+AijkH ye2aRuscVz0eqgnkmcNI+OxN3M9YDHPSBXKrxoCK1M6Ya+SWBLKtFb5W6H9jLjytUbEF W6AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EU2LDmaF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si11513825pgq.207.2019.01.11.13.19.36; Fri, 11 Jan 2019 13:19:51 -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=@linux-foundation.org header.s=google header.b=EU2LDmaF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfAKUrB (ORCPT + 99 others); Fri, 11 Jan 2019 15:47:01 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42139 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726482AbfAKUrB (ORCPT ); Fri, 11 Jan 2019 15:47:01 -0500 Received: by mail-lj1-f194.google.com with SMTP id l15-v6so14069118lja.9 for ; Fri, 11 Jan 2019 12:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Xiz1AmOzy/ByGNqNChkzXJ1iGhA9KMYgWTx3xlbkeA8=; b=EU2LDmaF072sHlPiWXu4RcpOHTSBfi40aFP9bGzCo3wRHUnC4ZtrBHk+9U7Yd6dXmD 6aNlIXMKAsB/zke9cJczPxhQ/J/mmmPBUlTJcOBld7tqW7pMFgpWNLljMp4vvnSiP3kf JNxw53VwMDQDjPjcZtgn64+ckXvNZrBscPAk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Xiz1AmOzy/ByGNqNChkzXJ1iGhA9KMYgWTx3xlbkeA8=; b=lPcbHVtUrMBuU2GRifKX94LnJx3KRQf4jbwCwUF28c0x6OWNq47NCOLHJfKUsJjBCH vKJSOSvr43DbFLXBm4Sh2AARU59muwTkawZkeHW4wfTRPxTPTSa5cq2dGRKsIWAO+SnY A3omkAm1PHQ4Bj5ImogVGJ0adr/ypMr++aiBIMOduKYBMqoiiN9mk1bzJ0QBoMuxUcIq cCudtMErHFxahV12ufMbt/26b6Dz0KqnOyQcaGNLOKh4rmuOLae34mSbWHx7UzLy7XuM dxbK3K0KNGV/G6YM/h2p0YmU+kf+r0GKojw+R2KjkrguLi1FBl8M/1xgAII9Xh9xhFb3 5cBA== X-Gm-Message-State: AJcUukeEyhqTCAvCiVccv+ogCVLd8XFj4MyyhmZpBsVB8+V0eNDlLdfw se4S3nj+UHkPKwEndCORmEmXcbXYZGU= X-Received: by 2002:a2e:5b93:: with SMTP id m19-v6mr8090565lje.115.1547239618374; Fri, 11 Jan 2019 12:46:58 -0800 (PST) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id v19sm14833516lfe.69.2019.01.11.12.46.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 12:46:57 -0800 (PST) Received: by mail-lj1-f175.google.com with SMTP id u89-v6so14105615lje.1 for ; Fri, 11 Jan 2019 12:46:56 -0800 (PST) X-Received: by 2002:a2e:3e04:: with SMTP id l4-v6mr8987490lja.148.1547239616134; Fri, 11 Jan 2019 12:46:56 -0800 (PST) MIME-Version: 1.0 References: <20190110203023.GL2861@worktop.programming.kicks-ass.net> <20190110205226.iburt6mrddsxnjpk@treble> <20190111151525.tf7lhuycyyvjjxez@treble> <20190111200420.qtyffayxceysoarf@treble> <20190111203135.5clurevf34bkiy3o@treble> In-Reply-To: <20190111203135.5clurevf34bkiy3o@treble> From: Linus Torvalds Date: Fri, 11 Jan 2019 12:46:39 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 0/6] Static calls To: Josh Poimboeuf Cc: 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 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. > Regardless, the trampoline management seems more complex to me. But > it's easier to argue about actual code, so maybe I'll code it up to make > it easier to compare solutions. I do agree hat the stack games are likely "simpler" in one sense. I just abhor playing those kinds of games with the entry code and entry stack. A small bit of extra complexity in the code that actually does the rewriting would be much more palatable to me than the complexity in the entry code. I prefer seeing the onus of complexity being on the code that introduces the problem, not on a innocent bystander. I'd like to say that our entry code actually looks fairly sane these days. I'd _like_ to say that, but I'd be lying through my teeth if I did. The macros we use make any normal persons head spin. The workaround for the stack corruption was fairly simple, but the subtlety behind the *reason* for it was what made my hackles rise about that code. The x86 entry code is some of the nastiest in the kernel, I feel, with all the subtle interactions about odd stack switches, odd CPU bugs causing odd TLB switches, NMI interactions etc etc. So I am fully cognizant that the workaround to shift the stack in the entry code was just a couple of lines, and not very complicated. And I agree that I may be a bit oversensitive about that area, but it really is one of those places where I go "damn, I think I know some low-level x86 stuff better than most, but that code scares *me*". Which is why I'd accept a rather bigger complexity hit just about anywhere else in the code... Linus