Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4633173ybi; Tue, 11 Jun 2019 09:47:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzyIFKc11IwRzk7dwHq0lBSBdU+gbWproMCEADX4aWYQ2wIv9XckTNhDDI6U7tcHLIIXUU X-Received: by 2002:a62:6241:: with SMTP id w62mr82702627pfb.226.1560271628579; Tue, 11 Jun 2019 09:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560271628; cv=none; d=google.com; s=arc-20160816; b=O+L2qA6EK4KGt8L3ZBsFh5q1MCECsnbFeQEJXSVJz1lSDkiZ4urgs665lei+tRrc58 TKmoadNQwNSdAb8jzpGQoTK4qeudtyewtP0dMJetBEJbvkTsIX3b6z4RTMJWdXqqKdUA jTh+zt3IHcYzgQeQBk2Zy9HQZ7dWLTxHOLyaSCBbVxFwcNx2FXobXUqGmWvJL3YRRf6P w/7vsuLWp0lqQCPBYWUL4zUR463Ab5L6bTC55ECA+NjKAML2vcl+CgkKj7ZSurSpun/3 kDBBHi9D4z3a6mHO4WnTokiDfVVebb9I6DWUY1pKD3cOBjF6HhJC6qaAvOkRzpYhi/fV 0JaA== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=3k0Ox7UdwQzye874uavi2NVIjb+IZPQmNve5cQJtSys=; b=t9aJAx2MWqwqEI3ThoNekncA6p1XCjtwD3fSjZLFMubie4gTTDDlOwqR2kbrkab+Oi NbNk0h7W+1yBNT8GaDgfsIQ4AuZ18iS8s/3FTcqSZU8i4+CsBikVaCF/Jcuy1vVD0vTm LvK6efYhZpP0UcGDWIiEF1leYc0HSid5MJNwVOczXqslMsa6Fh2PJovjavGXzsosNLLS OPz+vt6GkCvyt+UZTNUFqwm95U5KM/marM/O+hQ0MijX79teACjbVzRMwxQAVPHQaO9L dn1nguHIfmoi1IRTiPZ4H8s6RVmlOkDQz9cs7ZtlsyGKQc07lpNzJICbtOm6azyDYcpz 9hzA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si2763813pjq.31.2019.06.11.09.46.53; Tue, 11 Jun 2019 09:47:08 -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; 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 S2391904AbfFKQLR convert rfc822-to-8bit (ORCPT + 99 others); Tue, 11 Jun 2019 12:11:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:45348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388744AbfFKQLQ (ORCPT ); Tue, 11 Jun 2019 12:11:16 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3FE1A21726; Tue, 11 Jun 2019 16:11:14 +0000 (UTC) Date: Tue, 11 Jun 2019 12:11:12 -0400 From: Steven Rostedt To: Andy Lutomirski Cc: Peter Zijlstra , Masami Hiramatsu , x86@kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Andy Lutomirski , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Nadav Amit , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira Subject: Re: [PATCH 08/15] x86/alternatives: Teach text_poke_bp() to emulate instructions Message-ID: <20190611121112.1c96aec3@gandalf.local.home> In-Reply-To: <435093E5-6FE3-4DAA-9ABE-EB9D372F8CF8@amacapital.net> References: <20190605130753.327195108@infradead.org> <20190605131945.005681046@infradead.org> <20190608004708.7646b287151cf613838ce05f@kernel.org> <20190607173427.GK3436@hirez.programming.kicks-ass.net> <3DA961AB-950B-4886-9656-C0D268D521F1@amacapital.net> <20190611080307.GN3436@hirez.programming.kicks-ass.net> <435093E5-6FE3-4DAA-9ABE-EB9D372F8CF8@amacapital.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Jun 2019 08:54:23 -0700 Andy Lutomirski wrote: > How does that help? If RIP == x+2 and you want to put a 5-byte jump > at address x, no amount of 0xcc is going to change the fact that RIP > is in the middle of the jump. > > Live patching can handle this by detecting this condition on each > CPU, but performance won’t be great. Maybe some synchronize_sched > trickery could help. We have synchronize_rcu_tasks() which return after all tasks have either entered user space or did a voluntary schedule (was not preempted). Or have not run (still in a sleeping state). That way we guarantee that all tasks are no longer on any trampoline or code paths that do not call schedule. I use this to free dynamically allocated trampolines used by ftrace. And kprobes uses this too for its own trampolines. -- Steve