Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp9000557ybi; Fri, 7 Jun 2019 01:41:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUxot2z9nTgBUVKShOJW5rrzmAg3ooH7Ol55YKnVI3Z0e1tvpi5t/IaN0Phym46Y2MMlcz X-Received: by 2002:a17:90a:d3d7:: with SMTP id d23mr4023067pjw.26.1559896867520; Fri, 07 Jun 2019 01:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559896867; cv=none; d=google.com; s=arc-20160816; b=yEo9UAXzyqLZTouZf1nndXF1xthb+t9j4G47q12BOpw8Npk8ypAJsovPC45DvdSYxJ UEeN40cKrnIc63vkdYISxGGio3CO4MBf8gBmP0qq40HrEY8dEfKFOXqvk5Jj++BNGOCt SLnhEQuy2c+Kqg2uKm1gwtIy7cvplrjrFvC0KoHDC/5G8IZUlmVBUrcIWOfVnc3agANm 3sela59g46VF8KLK11221/l/mjNM31yLmLTDki58YuVDIwN7AD6Tb7uQ+Y1ug/y4WAuS cgUh4LfM2UQF8+Og5Tr0mgi0VtSha+u+Dc9yqsuSx0EuceLZx8JXQ56PkrCjah2p3hgp ztwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DI7Fs/1DQ5Cn1nmJ570WObqSu6i4Yj7LrxklY7389Uc=; b=XFC/vQgrRE76/i2tKN3WO2/+NsBgd8Gub/QFbWIvNXn+Jv/ThiY1AimK2/ikZ1bR2U Nj00C14VmjrzxcTua9MjxpN5sE4U/HanVBUFoeck4QcZh+J8wrOPxwXQXZykUxQeAOob ivTazdcX4hScxbldz4zcMPghWlkzl/LFkxqop0gf5wkncK9a7JiXb6agQsME5sJU6CU0 FndVO1vpk8O+WLkgp1Iyn5FRYt1YNPkrAaxbwifGSSpZIXXN+iebl33H4SiymeqUU3k+ VDatIF/GVhmPmYZyT3Q8I7kMIJk2YmQkgUYfYnqb04EQdt1e8CXBhWhdmEaE3K4NRNxf Lpjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=qercaASS; 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 w2si1270220pga.495.2019.06.07.01.40.51; Fri, 07 Jun 2019 01:41:07 -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=@infradead.org header.s=merlin.20170209 header.b=qercaASS; 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 S1727371AbfFGIjW (ORCPT + 99 others); Fri, 7 Jun 2019 04:39:22 -0400 Received: from merlin.infradead.org ([205.233.59.134]:47822 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbfFGIjV (ORCPT ); Fri, 7 Jun 2019 04:39:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DI7Fs/1DQ5Cn1nmJ570WObqSu6i4Yj7LrxklY7389Uc=; b=qercaASSfzHrtRcjT1K1fZX7C4 kqaZNJDYXQFjZKzny6G6KDsxtdLld5enRuJ3KM7Fjb5cAWTjUouUe/psUNX1KMI5+wv+wpMCON9MI UWD6s39s7yks1j/0GcxakXgvqGhc8Obzc+KBabseM57yRdkmRIDQJomr0jw1QZ/YZIYeSRp9x86IZ djRqrUkzrKTqUriQdmwIuUhC1pjCM5HKymegKwpP8ZhRyCcqsqGfAu049QBJxGAfE496IcG9XPNi/ /cwSFfpo/QSRJ0JZp6TTx7N5+6aNJWr8xFT3hB/SqnPBRGctqBMKzSfLZh1gLigKaaIuttFemWy5o Njr8aOiQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hZAOd-0006Ya-Gu; Fri, 07 Jun 2019 08:38:48 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 520952097357A; Fri, 7 Jun 2019 10:38:46 +0200 (CEST) Date: Fri, 7 Jun 2019 10:38:46 +0200 From: Peter Zijlstra To: Nadav Amit Cc: the arch/x86 maintainers , LKML , Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , 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 , Josh Poimboeuf Subject: Re: [PATCH 12/15] x86/static_call: Add out-of-line static call implementation Message-ID: <20190607083846.GX3419@hirez.programming.kicks-ass.net> References: <20190605130753.327195108@infradead.org> <20190605131945.254721704@infradead.org> <37C2FB32-3437-48CB-954D-05F683B7D80B@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <37C2FB32-3437-48CB-954D-05F683B7D80B@vmware.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 07, 2019 at 06:13:58AM +0000, Nadav Amit wrote: > > On Jun 5, 2019, at 6:08 AM, Peter Zijlstra wrote: > > +void arch_static_call_transform(void *site, void *tramp, void *func) > > +{ > > + unsigned char opcodes[CALL_INSN_SIZE]; > > + unsigned char insn_opcode; > > + unsigned long insn; > > + s32 dest_relative; > > + > > + mutex_lock(&text_mutex); > > + > > + insn = (unsigned long)tramp; > > + > > + insn_opcode = *(unsigned char *)insn; > > + if (insn_opcode != 0xE9) { > > + WARN_ONCE(1, "unexpected static call insn opcode 0x%x at %pS", > > + insn_opcode, (void *)insn); > > + goto unlock; > > This might happen if a kprobe is installed on the call, no? > > I don’t know if you want to be more gentle handling of this case (or perhaps > modify can_probe() to prevent such a case). > yuck.. yes, that's something that needs consideration.