Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp485952imm; Fri, 5 Oct 2018 07:04:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV628VYKdBRm9445as1+t0kOh72PLMffUCfC+S6QR6r/hbDN9i/zJs7JOqaJL52iIUWvcdynh X-Received: by 2002:a17:902:1101:: with SMTP id d1-v6mr11954065pla.131.1538748280969; Fri, 05 Oct 2018 07:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538748280; cv=none; d=google.com; s=arc-20160816; b=lk6HHfLPIKq5bJHWGUtcvwoYNTfSWJrbxy7/AYPliUxi/GPz9wq7LcFBxfmf0GTAKY elPf1L9ddYECDi9uDIOfAw+HSI0s+um2qdaHW9XaVeNfGCvEMAgUXOlgKGDPyVEcUnmk sLRuviNu8IFxC0aeOeYk3ShLWMf/VUiRSvtoVD/tuy0vmMqvjRdBH2ul/ih15yHCfkI2 LbnwQd5naEQWC8ZObYqlfZkCEi90FGORPZpqKvn3lI+57ZH8lIvsE8DkHSi09fZXrzQh Flu+ZhnPg817zCNmfPQVw0+bfNQJI79cuxciSuiLnH3lA+xcAreDqio3glGR1GV7EaCN 72sg== 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 :references:in-reply-to:mime-version:dkim-signature; bh=HVMWWg/mFD5PXPFOehRjIN8RzKVxwNX8V7J9t8QauFE=; b=Kt8vNIESrrjOLLRwsHLAhsblVmJFAB1DOKhzx8a0ihyx5SudOsHSaa8Mvb+jFwBNzO DUfUCcxjCiESzSN5RvOc7QMn33KVJwDa9UxJhHa2wlDMAGrvriFjFsy3vF++cN55snSO btoIrWhArJfVKCaYYedugo2MuerBhyd1FOdVOaiOllM+MHLjF2rXmI2p1bfv9s3aEmJU xpExfgFGPuG1RWpG8JJn+dIJnGGb3sUGw8jeZrsZbgn85btpwMUHvIFM29vk2k3zCEhc Pl7OqxC26cOQa2MpgiUtwVuUdTxHnbPSkg6EqHR1aEo7QUGWXbMXpJ7iy2ZCBfhzuDjx UT5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XpgsJjsg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si8269815pgh.244.2018.10.05.07.04.24; Fri, 05 Oct 2018 07:04:40 -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=@linaro.org header.s=google header.b=XpgsJjsg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728624AbeJEVCr (ORCPT + 99 others); Fri, 5 Oct 2018 17:02:47 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:37969 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727581AbeJEVCr (ORCPT ); Fri, 5 Oct 2018 17:02:47 -0400 Received: by mail-io1-f68.google.com with SMTP id n5-v6so381395ioh.5 for ; Fri, 05 Oct 2018 07:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HVMWWg/mFD5PXPFOehRjIN8RzKVxwNX8V7J9t8QauFE=; b=XpgsJjsg0FQXAuT8PNue7Tqx3IR/J7a+g2BQ5zLsVJlb0YPhU/wYgioDt6tNxMhgcU druYByvNgzYVkAL45oandJmyT3StCL1JRuYruX4NW+bzqzuDwp/wjAqZgjEOo/fAYm6x 2rJXfvq8L0mjZuY5qa38LF7rvY5cOMZmy6K+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HVMWWg/mFD5PXPFOehRjIN8RzKVxwNX8V7J9t8QauFE=; b=KycIcn0y5tERRBO7X3kuGDrvK3pSgLox98JqEG/mp6k1suJs4ThbgxZBzP+f8ytscI Eu7opPaClUTUE5XoUpz6lJkXn1AFHHimRVpy9ahuFnOon7Iyz+mVI2zaR95ByeX+L3gN MTzMPTGdMcKgXPzv0EwzQOM/lPWMoC4QsdQrcpK0QkZgOA7l0ymVqGfrWhhUYLs8YJh3 ePbXHlF0SvaYqAMfQqWsLg2fJqTVS95SqrFor24nSFetyeycwoGC3r2TDU6T6XR2L86j AISElGeXtF1813CjBpuekGBdUnr5ZKKx4PwUD5XK31Pb80GzpWy+9vFGVsQJN5aUfRS2 vYRw== X-Gm-Message-State: ABuFfohC0x7MXVaWtCchghV95bFzPNtA/+SMx9eiQ9yh64zloezBd/zp 1bsHCk017RyNtyk9EWuorF7vzT48hTuJSCGLrOQWcLKN X-Received: by 2002:a6b:3787:: with SMTP id e129-v6mr8267883ioa.60.1538748234165; Fri, 05 Oct 2018 07:03:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:5910:0:0:0:0:0 with HTTP; Fri, 5 Oct 2018 07:03:53 -0700 (PDT) In-Reply-To: <20181005135728.GR19272@hirez.programming.kicks-ass.net> References: <20181005081333.15018-1-ard.biesheuvel@linaro.org> <20181005081333.15018-2-ard.biesheuvel@linaro.org> <20181005135728.GR19272@hirez.programming.kicks-ass.net> From: Ard Biesheuvel Date: Fri, 5 Oct 2018 16:03:53 +0200 Message-ID: Subject: Re: [RFC PATCH 1/9] kernel: add support for patchable function pointers To: Peter Zijlstra Cc: Linux Kernel Mailing List , "Jason A . Donenfeld" , Eric Biggers , Samuel Neves , Andy Lutomirski , Arnd Bergmann , Herbert Xu , "David S. Miller" , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Gleixner , Ingo Molnar , Kees Cook , "Martin K. Petersen" , Greg Kroah-Hartman , Andrew Morton , Richard Weinberger , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , linux-arm-kernel , linuxppc-dev 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 5 October 2018 at 15:57, Peter Zijlstra wrote: > On Fri, Oct 05, 2018 at 10:13:25AM +0200, Ard Biesheuvel wrote: >> Add a function pointer abstraction that can be implemented by the arch >> in a manner that avoids the downsides of function pointers, i.e., the >> fact that they are typically located in a writable data section, and >> their vulnerability to Spectre like defects. >> >> The FFP (or fast function pointer) is callable as a function, since >> the generic incarnation is simply that. However, due to the fact that >> C does not distinguish between functions and function pointers at the >> call site, the architecture can instead emit it as a patchable sequence >> of instructions consisting of ordinary branches. > > This is basically a static_key, except for indirection function calls? Yes, that is why I put you on cc :-) > So why not call the thing static_func or static_call or something like > that? Yep that sounds better.