Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2773729imu; Thu, 29 Nov 2018 10:00:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHsbkBuxI7xdjbjYzLehmGfYxcBP6yRdnfxKMzF/6ofbbiE833PgwkvY/YZMrqkp++R9wG X-Received: by 2002:a17:902:9691:: with SMTP id n17mr2480948plp.9.1543514438298; Thu, 29 Nov 2018 10:00:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543514438; cv=none; d=google.com; s=arc-20160816; b=nG4pk2yk3rS4A9E4fj7bo3jYZ+2aEQtS5HKtrEYGFvP6hKUDKsA5g6mg/rn+qZPCqv 64Y/GXm89AFb/aFxXPLloYJhqB4ZBwe54IGtAQbRoXdIgTd47rjDyBBm4/0XFolFkbKD dlJzqrQH2Un2VjNQlIBy/77faQg1OlSY2kHEShG801OMNvzuJuB8o6W/C5jBX2MqHomT yU/l5sSpxZ8BKEpit6R8XqA8qlKvCezbERmQ434SHd6A/bZBh5CosvZT3yQzdhAd2JJI XGIRnyHUS6Us053OrixilDXQZdZmZr+uIxZQlNrsQdUGwyIOsNkxmxMAZ2hQIh531KOx CTjg== 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=kHrdmLOvSqDmCLa63MxnNPLqI89EjOEruPNO/p0uv28=; b=YMDdJrQtd/GTbhGjSXlwVm2WsoVOda7qdKoLX4MRDGgnuOplFriZoKHuGlbInv2TSq SpW1Q17GE63mI0cO4FJho6pX0EjJnI00t4P8cGIKqegqLbkSzuL9BVoozBTFOP400izO Mw/NQvfhCnqnQ38gY+4D/NIOOOhudzys9j+YKY/l4OUwUtH/zj83oZmZNMeE+jmror+z wOJ7U4Pq5f31OML421GTcX4DUSEoG3xEmSV08qV1OzGZig5J9YZsaHfOwQZrrwkadYMK 3+xdjJun9gfvA8ZLcz9W08OCe3FSwvJj2yS1EMjpQZHQdkF2Gb4ykwVxeMNTn7EdD3Xt tfFg== 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 h10si2497408pgi.562.2018.11.29.10.00.21; Thu, 29 Nov 2018 10:00:38 -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; 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 S1726521AbeK3FFN (ORCPT + 99 others); Fri, 30 Nov 2018 00:05:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:58454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbeK3FFM (ORCPT ); Fri, 30 Nov 2018 00:05:12 -0500 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (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 F1E8F21019; Thu, 29 Nov 2018 17:58:58 +0000 (UTC) Date: Thu, 29 Nov 2018 12:58:57 -0500 From: Steven Rostedt To: Linus Torvalds Cc: Andy Lutomirski , Josh Poimboeuf , Peter Zijlstra , Andrew Lutomirski , "the arch/x86 maintainers" , Linux List Kernel Mailing , Ard Biesheuvel , Ingo Molnar , Thomas Gleixner , mhiramat@kernel.org, jbaron@akamai.com, Jiri Kosina , David.Laight@aculab.com, bp@alien8.de, julia@ni.com, jeyu@kernel.org, Peter Anvin Subject: Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64 Message-ID: <20181129125857.75c55b96@gandalf.local.home> In-Reply-To: References: <20181126160217.GR2113@hirez.programming.kicks-ass.net> <20181126171036.chcbmb35ygpxziub@treble> <20181126175624.bruqfbkngbucpvxr@treble> <20181126200801.GW2113@hirez.programming.kicks-ass.net> <20181126212628.4apztfazichxnt7r@treble> <20181127084330.GX2113@hirez.programming.kicks-ass.net> <20181129094210.GC2131@hirez.programming.kicks-ass.net> <20181129143853.GO2131@hirez.programming.kicks-ass.net> <20181129163342.tp5wlfcyiazwwyoh@treble> <0A629D30-ADCF-4159-9443-E5727146F65F@amacapital.net> <20181129121307.12393c57@gandalf.local.home> <20181129124404.2fe55dd0@gandalf.local.home> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Nov 2018 09:50:28 -0800 Linus Torvalds wrote: > On Thu, Nov 29, 2018 at 9:44 AM Steven Rostedt wrote: > > > > Well, the current method (as Jiri mentioned) did get the OK from at > > least Intel (and that was with a lot of arm twisting to do so). > > Guys, when the comparison is to: > > - create a huge honking security hole by screwing up the stack frame > > or > > - corrupt random registers because we "know" they aren't in use > > then it really sounds pretty safe to just say "ok, just make it > aligned and update the instruction with an atomic cmpxchg or > something". Do you realize that the cmpxchg used by the first attempts of the dynamic modification of code by ftrace was the source of the e1000e NVRAM corruption bug. It's because it happened to do it to IO write only memory, and a cmpxchg will *always* write, even if it didn't match. It will just write out what it read. In the case of the e1000e bug, it read 0xffffffff and that's what it wrote back out. So no, I don't think that's a better solution. -- Steve > > Of course, another option is to just say "we don't do the inline case, > then", and only ever do a call to a stub that does a "jmp" > instruction. > > Problem solved, at the cost of some I$. Emulating a "jmp" is trivial, > in ways emulating a "call" is not. > > Linus