Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3788219imm; Mon, 8 Oct 2018 09:30:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YUVp3u4l9GINe2nyULceRiLNkd8YqVwflAfOEmw5GSryRTE91Y51OylUHwa+DRwpnjuVk X-Received: by 2002:a17:902:8d82:: with SMTP id v2-v6mr25381738plo.9.1539016227648; Mon, 08 Oct 2018 09:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539016227; cv=none; d=google.com; s=arc-20160816; b=IcXKeBJo5utgcMY3eH4l6efDgQkY2oSQVN0omWgl6PkFoh7yMEIZgRaEdi+7LrAqTl lotkRUB365QigQypsIIvoVhXBS8jejTGkV0RVR6gWGeYBGex4NQMsoQ9nJaLCyIl7avJ o40XUwWCHnslXWykrv086pKwSmztnC3t1CWjyGW01pgaBF4qtffERaEV2hH1uydQ96/6 MtnHZ46DzMOGO0i7//DPz/e9YX8y7lxkfbPpI8OR63EJA8jbH9FrpGJMag1AOCgxFZAk r83UzByHU03aqkiYLNWsUj3kYp9nETso9NE6/UdtFYzoZ9tsATWjJc7mNFWioYfsMH0B OKUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=o10MbsYKlJ1hXQ2t+BydwRhuW/v1ses3zLRCbNJuo2w=; b=wlCXP5zJTU3BdATQtBvz0ytZ6vGiJUTKhZQMHZYwFgdOXA9VAQzYs9mQGnZrH5zsvl dQxVBfTbfmYUv2iCJRuukphzl2lzz8swD2DzrgOSWicVJGeUCeQ3FQWHDD5uGZ1yBcG0 PeXf1G/Nj+e23f/UADUesWkbAfNiy4Rem9JOiEiUEMoH9HEIwEiK+kZ44qg963pvSn+G PQI0U8mKHYeL36r7k4h+5EteUSbVlAGDYs1QsDRu2Os6Ej9qZZOKkI2g+JxCeybRUFmI Pc8Q9hjiTq3UiYLAzKXd3R0o97FRzJYhLjoLhBN91AYY8TdzVIQx05HSCUOGNz8fkzqv fNOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=dCdCdrJq; 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 b12-v6si17683881pls.367.2018.10.08.09.30.12; Mon, 08 Oct 2018 09:30:27 -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=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=dCdCdrJq; 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 S1726568AbeJHXma (ORCPT + 99 others); Mon, 8 Oct 2018 19:42:30 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36907 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeJHXm3 (ORCPT ); Mon, 8 Oct 2018 19:42:29 -0400 Received: by mail-pl1-f196.google.com with SMTP id az3-v6so10308479plb.4 for ; Mon, 08 Oct 2018 09:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=o10MbsYKlJ1hXQ2t+BydwRhuW/v1ses3zLRCbNJuo2w=; b=dCdCdrJqcPQgVn3mn8Uil/DBWOtvfGT3HmVRmSAT8Z+63WYFkaEu79TcC8/08/zI5L iUAzM4z7Zq5rwmv2G3pHUSiWOW9r9wT727f7sWpEVPyGGzBG2XB2HFEzy4YCgk+2HXLb nlhrOyzwT9aSP0gwLhEuNAaBHtHiZ3yX/c5p6cYkXrLMGd2cD8qLwgneyeN8M3eVhrbU +IT2BHfJIJnRhtKTDeS7GrSXUaF2oo+X+BYj1fcMJjJ7KOFjHESGn4tKRyS40aduk/kO VzbqJAw8dLoH3w1r/jTe09N1dSFJOPD9+y2YT4APZwsnNGnPwF2a45BLJmDLj6eHfVmB a4IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=o10MbsYKlJ1hXQ2t+BydwRhuW/v1ses3zLRCbNJuo2w=; b=bWhj9ihU+Grh+k58/oxueydlnieccRrjqVUrbu93IPTgcjbsmWKuVttaddZMtaOod8 IOlj4gEMeWjcDwd6QlJBUeUlYwNDZXrT4rTA5OyAGjbkRMmu2oCmz2YwN3APcHfQ0CdO RPooGgFmU/+1UTbGzbumF2FmKM0q8xQ4fYFM21tt6G825AKSwoNFiFN/3pvpcXSTDoNt ug8zfESF3xS0WJ5441qAWJGiE7UvdulSys83AoDuWF1GaEyq8xM8JvS53zFcr96CBC1G fR1iHRlEnNVCn//65A5RSfq4lk031t71vLNa019zjjQQKTYi6MhM4sZTxIHwf7D2wMZu jxMA== X-Gm-Message-State: ABuFfoiS2fJMgOKSpsD5MyBYxuctqqYwQCv0WvLeqit0UzfZGl6pDuRn PGg6LmeS3odaCpk2CedQMmQiAQ== X-Received: by 2002:a17:902:9f8c:: with SMTP id g12-v6mr25316654plq.309.1539016198216; Mon, 08 Oct 2018 09:29:58 -0700 (PDT) Received: from ?IPv6:2601:646:c200:7429:945b:1f25:be7:bc4b? ([2601:646:c200:7429:945b:1f25:be7:bc4b]) by smtp.gmail.com with ESMTPSA id u77-v6sm29516726pfj.40.2018.10.08.09.29.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 09:29:56 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [POC][RFC][PATCH 1/2] jump_function: Addition of new feature "jump_function" From: Andy Lutomirski X-Mailer: iPhone Mail (16A366) In-Reply-To: <20181008155757.GC5663@hirez.programming.kicks-ass.net> Date: Mon, 8 Oct 2018 09:29:56 -0700 Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Masami Hiramatsu , Mathieu Desnoyers , Matthew Helsley , "Rafael J . Wysocki" , David Woodhouse , Paolo Bonzini , Josh Poimboeuf , Jason Baron , Jiri Kosina , ard.biesheuvel@linaro.org, Andy Lutomirski Content-Transfer-Encoding: quoted-printable Message-Id: References: <20181006015110.653946300@goodmis.org> <20181006015720.634688468@goodmis.org> <20181006121211.GA5663@hirez.programming.kicks-ass.net> <20181006093905.46276505@vmware.local.home> <20181008072134.GB5663@hirez.programming.kicks-ass.net> <20181008155757.GC5663@hirez.programming.kicks-ass.net> To: Peter Zijlstra Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Oct 8, 2018, at 8:57 AM, Peter Zijlstra wrote: >=20 > On Mon, Oct 08, 2018 at 01:33:14AM -0700, Andy Lutomirski wrote: >>> Can't we hijack the relocation records for these functions before they >>> get thrown out in the (final) link pass or something? >>=20 >> I could be talking out my arse here, but I thought we could do this, >> too, then changed my mind. The relocation records give us the >> location of the call or jump operand, but they don=E2=80=99t give the add= ress >> of the beginning of the instruction. >=20 > But that's like 1 byte before the operand, right? We could even double che= ck > this by reading back that byte and ensuring it is in fact 0xE8 (CALL). >=20 > AFAICT there is only the _1_ CALL encoding, and that is the 5 byte: E8 , > so if we have the PLT32 location, we also have the instruction location. O= r am > I missing something? There=E2=80=99s also JMP and Jcc, any of which can be used for rail calls, b= ut those are also one byte. I suppose GCC is unlikely to emit a prefixed for= m of any of these. So maybe we really can assume they=E2=80=99re all one byt= e. But there is a nasty potential special case: anything that takes the functio= n=E2=80=99s address. This includes jump tables, computed gotos, and plain ol= d function pointers. And I suspect that any of these could have one of the r= ather large number of CALL/JMP/Jcc bytes before the relocation by coincidenc= e.