Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp898267ybp; Fri, 4 Oct 2019 06:44:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2RQir7vTapHf1CrYkrTaioDy8QTSwO0aXouFy1k+cDpiDd6CIzW0JmJir8u2SLDVNm1fJ X-Received: by 2002:aa7:d816:: with SMTP id v22mr2891716edq.28.1570196648546; Fri, 04 Oct 2019 06:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570196648; cv=none; d=google.com; s=arc-20160816; b=Du8jM8qFHV4V9RGqn4JBhQ9HWdZH/J/8oApTh7OQRaZAtika+exG7qrm9AAweMSfaJ iy/sTlwgVIJMalKQlOIuz5kqRKmz9+4PeZQfgOSXrRalV4/1m4Fbwri0FCpHkB2upqy2 da8IKlAiNJJSljptIln2lU5mrQXxCOtUPpLmdLZY3ca2ItsV+rsfx/dr36OFWSRCa3R2 NjgdpkFURzP16OnnpZEdzPyKXfhtxUZ70C04tV1TvEkRJ+BhLcAiLy4clznoun6i0o10 3fgY3tuWABeOuGxxoCvqFITv5E+tD0/3N9E/wFP7ltgp1MiLTW0OVFNCKJSdsRI4JD6E GI8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6leHiBTvdrH/NJBwSThK9D32TzWSSYbIyn2JRXXivCI=; b=VrzoPpNSso7iZF0Le//HP02/LrEL3ern1D0kg8gVGRxj/Cvgl0gEVHg1Gk+Ao1EWuA XWRU/x4ZIknE2KfbSAYkpMg6HcPPpaslXbiRXPkhtq+jmTwXAMjBPBkVv5u2h6sn2XZU UROMMsyhYAHDaFxt/k5K49rO3FGOgrSHh5SjcWcjxHBbz0LzGbla/UxBDsGf3yrVMY/Y d+/Lq464eD0OUIQUXk+dyo68vyIY7Z6rn9WbPqeKRNu2IvN1NJv884SMwoaIIM/fw4tO oHlaV1izR2czl80PzChSmBgoCeZWT1raTBOungNIKI155T9ju2/CWwne6OspeoPRbXR0 2N/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=HuOupBf4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si3918911edj.354.2019.10.04.06.43.42; Fri, 04 Oct 2019 06:44:08 -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=@zx2c4.com header.s=mail header.b=HuOupBf4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388491AbfJDNml (ORCPT + 99 others); Fri, 4 Oct 2019 09:42:41 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:54141 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388438AbfJDNml (ORCPT ); Fri, 4 Oct 2019 09:42:41 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 0588d916; Fri, 4 Oct 2019 12:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=date:from:to :cc:subject:message-id:references:mime-version:content-type :in-reply-to; s=mail; bh=vuup28YcsFnhqU/UHJ0fGBHSEj0=; b=HuOupBf 4v9hRb1vIKNkmLK5dxjTl/qqPa9pywUmkUK8gALy7tjVE/WLEmsdxfLeUJh0kDpV QoNeL+/P4uCNIuwg5VPoeNbHpo1QDVcHN1PqvYi/INxEYBKoxemo8rdasUXqFbVd AJA18+vUMOppEHjWR+E9/sQtArNsPmdZ3f/Vsp2dLlMy9tXltlGtMEv+JaoqnX8P bYy6epyMTHVtefd1W3jK72ZYrQEiZ+BsuX8VaNQMsFjDmYEshDtTUiNCGhhg2UzU RTHTqNO5ngyEoHYyTA1zVMtFgpo8K0N5+SaXvyaTOl2xijOJUViy29AY1oSAQWys Kz0ZogORcaNDi1Q== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 0e548f4d (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Fri, 4 Oct 2019 12:55:45 +0000 (UTC) Date: Fri, 4 Oct 2019 15:42:33 +0200 From: "Jason A. Donenfeld" To: Ard Biesheuvel Cc: "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 Subject: Re: [PATCH v2 00/20] crypto: crypto API library interfaces for WireGuard Message-ID: <20191004134233.GD112631@zx2c4.com> References: <20191002141713.31189-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Oct 03, 2019 at 10:43:29AM +0200, Ard Biesheuvel wrote: > On Wed, 2 Oct 2019 at 16:17, Ard Biesheuvel wrote: > > > ... > > > > In the future, I would like to extend these interfaces to use static calls, > > so that the accelerated implementations can be [un]plugged at runtime. For > > the time being, we rely on weak aliases and conditional exports so that the > > users of the library interfaces link directly to the accelerated versions, > > but without the ability to unplug them. > > > > 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. You're saying that at module insertion time, the kernel will override weak symbols with those provided by the module itself? At runtime? 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? 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?