Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp978024ybp; Fri, 4 Oct 2019 07:51:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdJcHLqk+44OoqVZvlfbgORAfAFtQyyc1Y07rN4ZoHTV9XyAIEW8+izZ2oSd6CwFiHzWia X-Received: by 2002:a17:906:6084:: with SMTP id t4mr12621375ejj.164.1570200711660; Fri, 04 Oct 2019 07:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570200711; cv=none; d=google.com; s=arc-20160816; b=FV0LTWGBcDrP8K8ibhmWO7U7Uc8kTKXOGcpR1ikMJzke/sYyvM0peyvXc0rBkP0ys6 fCjan4Ndcvw5p5c4pbZdSWhinIXzn1txb2v0kQgIfod2edp2+XPy9HzOB9kPecrZpdq7 +Ss59JX9pQcfl8UmiqZ6nmoZb+x5HzQBkBdV23me3ntcrXDlfZmq76347LAYy+UobC/w 3tMLyZJRkSgu0yrflyPeZmU7LmyzR6CuvhvWy2eZfdX26cpSylqGKLpb6o2ZcftqHrIR GkBXwIflKxvMovxH8ijFFLKw6oFSV0zdrUl9Zg18s7R89Cjp43/5riAPNFJ8FU3Ms5H4 gwhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=O8dxtxZWf+wlgyrNHa8J6WMWv3Y1JgiQq/LyksoMXKo=; b=ySLMftWHBIlSHzUoDKji6ne1OPLGEVhxbJkBDyHiK/X8HI7dlzlSGNmSUWmd1ACBl4 DVNF+9Sj74sjD22Pya1viJkdGGMi9J4P11SfjYnunXqM2Lsst/gax7pkC/xUtkDug6PR sBbK1RWnQzfwn9zh7pP/seVuo0GEVsp+NE31yhgCgrjS/fRAtS9WLqs/mQ9sYo3CT9fk eSTKJ48iwLh08QJiDEvZADofFOXEVDPlGiF+epJ7P2bUOl2wUnnh12M3nlcwyA0f8nFy Y786V+KMKJ1oNI/X2EYr9qgpHcXedSTk1NfQC7fmwHOHUWwpKUMtWVE8VnzOvJ1SjRTi ldrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ni6TIZ2x; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 a41si3806680edc.180.2019.10.04.07.51.25; Fri, 04 Oct 2019 07:51:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=ni6TIZ2x; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388982AbfJDOuM (ORCPT + 99 others); Fri, 4 Oct 2019 10:50:12 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43017 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388870AbfJDOuM (ORCPT ); Fri, 4 Oct 2019 10:50:12 -0400 Received: by mail-pg1-f193.google.com with SMTP id v27so3867111pgk.10 for ; Fri, 04 Oct 2019 07:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=O8dxtxZWf+wlgyrNHa8J6WMWv3Y1JgiQq/LyksoMXKo=; b=ni6TIZ2xibkbxn64M/sIQDm9VxBwgdCPw6wV7y74lrPNiOONJfsyfxqmIVyv8bEcHb lvdOfFt73qel+LqVDHiOJ3BH4NlV20rNJ7UG9XnMLtu4z5sTBI6tLW2SH7tIHHtPyhwT C37cOVj8wK6JLS2vk5qLJ7prWHnAdU5UZkruNQCBi69ZghPqHyHa5DT9kz2K9YJnnw2C c1+CPsDxDky2VkHSeEOZB4U8mIloJD1LDyFUsaahZ32lit7LUF1OrakzgYl7Ljc2tKfD 916v/4CCBNd8jGVTC6fEktJPb1W5Lj1fTn1IsRQ6vpP6rwO86QKtRfnlkzFlMjEXd2BW bmvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=O8dxtxZWf+wlgyrNHa8J6WMWv3Y1JgiQq/LyksoMXKo=; b=f1/U0xDz/P/ymJ+qdgRi5YhAgGDf3EAll4onWuWeyCEpc/zv9pmGcGi/Qwt0gNhPqR ZEbZst4a6IRXhQaSwTz7g47fIDy6v0OulOyp5aL/NKWH8YCqtOVgHLW1eYptmam5yzYS ANTA4ANr+PoNus+rPh87wQVupP7VJAtNqEQuU2db9WNazUnqltZrzZhpBCDWrUVtYhub KJmaY4PYfABrKgoytHtGIopw7AcRFHbIHktFSGzOIXjKwglwNh5tIXfz0j8HhPaw5cAw YqJ5k0skfDGFa4CH5//Sz7zLZBAZVwFmzBuIU1kkEInlO9husTgvW58KHbX96PJFIpmv N16Q== X-Gm-Message-State: APjAAAV+2BGeq/8EKgXjFp7cVepdV3lvypoRRLX/BpO0VntMQhhU69/5 5UU5j2J6VvMIkSCS0xZgOdGNuQ== X-Received: by 2002:a17:90a:8416:: with SMTP id j22mr17199825pjn.39.1570200611470; Fri, 04 Oct 2019 07:50:11 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:b800:f509:3b99:5225? ([2601:646:c200:1ef2:b800:f509:3b99:5225]) by smtp.gmail.com with ESMTPSA id v20sm812616pgh.89.2019.10.04.07.50.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Oct 2019 07:50:10 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2 00/20] crypto: crypto API library interfaces for WireGuard Date: Fri, 4 Oct 2019 07:50:09 -0700 Message-Id: <63B7E067-9D6D-4F42-940D-37EDFCDD2E80@amacapital.net> References: <20191004134233.GD112631@zx2c4.com> Cc: Ard Biesheuvel , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Herbert Xu , David Miller , Greg KH , Linus Torvalds , Samuel Neves , Dan Carpenter , Arnd Bergmann , Eric Biggers , Andy Lutomirski , Will Deacon , Marc Zyngier , Catalin Marinas , Martin Willi , Peter Zijlstra , Josh Poimboeuf In-Reply-To: <20191004134233.GD112631@zx2c4.com> To: "Jason A. Donenfeld" X-Mailer: iPhone Mail (17A854) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org > On Oct 4, 2019, at 6:42 AM, Jason A. Donenfeld wrote: >=20 > =EF=BB=BFOn Thu, Oct 03, 2019 at 10:43:29AM +0200, Ard Biesheuvel wrote: >>> On Wed, 2 Oct 2019 at 16:17, Ard Biesheuvel w= rote: >>>=20 >> ... >>>=20 >>> In the future, I would like to extend these interfaces to use static cal= ls, >>> so that the accelerated implementations can be [un]plugged at runtime. Fo= r >>> the time being, we rely on weak aliases and conditional exports so that t= he >>> users of the library interfaces link directly to the accelerated version= s, >>> but without the ability to unplug them. >>>=20 >>=20 >> As it turns out, we don't actually need static calls for this. >> Instead, we can simply permit weak symbol references to go unresolved >> between modules (as we already do in the kernel itself, due to the >> fact that ELF permits it), and have the accelerated code live in >> separate modules that may not be loadable on certain systems, or be >> blacklisted by the user. >=20 > You're saying that at module insertion time, the kernel will override > weak symbols with those provided by the module itself? At runtime? >=20 > Do you know offhand how this patching works? Is there a PLT that gets > patched, and so the calls all go through a layer of function pointer > indirection? Or are all call sites fixed up at insertion time and the > call instructions rewritten with some runtime patching magic? >=20 > Unless the method is the latter, I would assume that static calls are > much faster in general? Or the approach already in this series is > perhaps fine enough, and we don't need to break this apart into > individual modules complicating everything? I admit I=E2=80=99m a bit mystified too. I think it would be great to have a= feature where a special type of static call could be redirected by the modu= le loader when a module that exports a corresponding symbol is loaded. Unlo= ading such a module would be interesting. Ard, what exactly are you imagining?=