Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10070033imu; Wed, 5 Dec 2018 15:39:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/WY+MCxx7vdE6Yfd9oXnoeDmIeFa8GDyIxvXJtiARHzvwZiu0BGKdhXQtUTH5knUywID5g8 X-Received: by 2002:a62:43c1:: with SMTP id l62mr26913774pfi.22.1544053146591; Wed, 05 Dec 2018 15:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544053146; cv=none; d=google.com; s=arc-20160816; b=gbts2dEFuXf2fG7iUstpGoDr60t9i4dh6Z8bklPY0emwe3x5L/Obf++JMTJRAID2IL tky/2mR9SS8/bJso/3bEsGhmsPtmjsn9lNaZXW7Tx+YInJ6LbbzgIMIqQKtkbUUr4z2G z9AzH0O/ONv2C0egnMpmpYipzBal0v9xIMFQGS3ah6K/mv4/SglruHVr6KfjJ08/Vuep yKGXy8xTG4rjKXdfj6aVqQwLaHf1sNMk10H7UU6hu54pySxG18VM/Yr97tH+UcpIS8rz sBY1RumVKIpAzv/CpR6/BoBQbGZfumbzeFkFY782bUXj8S0WkNddKVg1tnGHZ086+6vE zz+w== 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 :in-reply-to:references:mime-version:dkim-signature; bh=ir9MSZpuxM6D+erZKZloWc1q6q+x3L3ZGqxz9Yh0TO4=; b=i2/uTqi8wd+CFzdpPndDnA0OeqXh0OwrqIugIXSMFEU4gSk+9b3ucfsgqpeIDNMook H5/xgNxOw9pmAOR1pLtP49KdAapBGJlO92D/WyizuhN128Iony5ACeGh+rZym7uWZoQD d/5dZzyzfcdEVnvpbLYioz5FGcysyQ7cIJp3AArudXga33vuflmha+PgYTOs5BNeFid5 jocPYKSlM9kf9+jlAzmP6IcEW3jQ5tdFS1pMEjH+XBI8jd2pII7y4EiUCNmMIzAhqC9K WxVEI1ZZKOj6Ljpp+Sz4FwzCTEC8vTvRt+mK3oJUshxC3Q1fSkCM+aLtz494g9X1O8Fq UTTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ex4kS9Dt; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8si19625244pgm.467.2018.12.05.15.38.50; Wed, 05 Dec 2018 15:39:06 -0800 (PST) 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=@chromium.org header.s=google header.b=Ex4kS9Dt; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728799AbeLEXiC (ORCPT + 99 others); Wed, 5 Dec 2018 18:38:02 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:46923 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727592AbeLEXiC (ORCPT ); Wed, 5 Dec 2018 18:38:02 -0500 Received: by mail-yb1-f196.google.com with SMTP id l126so5711856ybf.13 for ; Wed, 05 Dec 2018 15:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ir9MSZpuxM6D+erZKZloWc1q6q+x3L3ZGqxz9Yh0TO4=; b=Ex4kS9DtDYkQSIpsukKr0vhqfyhKwtBBAxa+l0KRVdbys2db0GHKhtpTI8P/60oSf5 TbN0Z5qLrMprijW2j70mBM4T84o953HSSt5xaYgiT+7SeqkVjRctaS+3Accf69cce6TM aL4RlmS3NGyupnxZ+/atvbPk0L+VejHQcvcrg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ir9MSZpuxM6D+erZKZloWc1q6q+x3L3ZGqxz9Yh0TO4=; b=hV4dKJVgScUfBKg8kesKM0o0geCKlyGWWJG7jkzOApFxHVDSRhxmJye9Ch7qiA3JKZ H7hj5+E1VI/w6VRvxr1bAzickHsWEvRK0iDIkfzdRDO0/8xyc6wli3Wfre4uNhsAxi1G 8ZamNPQMEIaW/rimilyYrWdJoMQK4DHM7SuQFeXGGAuQRrCAQsLutrh/OC4YPdBYJ114 LXXw6coABl9l9gRugm6alg5mhxd1kdOyBclCClkU0bI3Z2RCIMfrzvw1U0ba3Emeo+M7 VPyIQM2JPui6DP2BcRnX+4n/AGYC7noOEu6zTHvNpldVKrMH0eqXDOcMFumWOvPHK1p4 9bhg== X-Gm-Message-State: AA+aEWaaHbXJykJINiyTzZ7qaF4St1cYWcsApMBARdTkeBV6xgP+FMKT hGJaq99jy4kFy9GDztuafSd/qMc81rg= X-Received: by 2002:a81:af27:: with SMTP id n39mr26412162ywh.452.1544053081256; Wed, 05 Dec 2018 15:38:01 -0800 (PST) Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com. [209.85.219.182]) by smtp.gmail.com with ESMTPSA id r20sm14578351ywa.13.2018.12.05.15.37.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 15:38:00 -0800 (PST) Received: by mail-yb1-f182.google.com with SMTP id d187so1345283ybb.5 for ; Wed, 05 Dec 2018 15:37:59 -0800 (PST) X-Received: by 2002:a25:a445:: with SMTP id f63-v6mr24461270ybi.171.1544053079487; Wed, 05 Dec 2018 15:37:59 -0800 (PST) MIME-Version: 1.0 References: <20181123221804.440-1-ard.biesheuvel@linaro.org> <20181123221804.440-2-ard.biesheuvel@linaro.org> In-Reply-To: From: Kees Cook Date: Wed, 5 Dec 2018 15:37:48 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/2] bpf: add __weak hook for allocating executable memory To: Rick Edgecombe Cc: LKML , Ard Biesheuvel , Daniel Borkmann , Jessica Yu , Jann Horn , Alexei Starovoitov , Mark Rutland , Catalin Marinas , Will Deacon , linux-arm-kernel , Network Development , Eric Dumazet , "David S. Miller" , Arnd Bergmann 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 Mon, Nov 26, 2018 at 9:02 AM Edgecombe, Rick P wrote: > > On Fri, 2018-11-23 at 23:18 +0100, Ard Biesheuvel wrote: > > By default, BPF uses module_alloc() to allocate executable memory, > > but this is not necessary on all arches and potentially undesirable > > on some of them. > > > > So break out the module_alloc() and module_memfree() calls into __weak > > functions to allow them to be overridden in arch code. > > > > Signed-off-by: Ard Biesheuvel > > --- > > It looks like some of the architectures call module_alloc directly in their > bpf_jit_compile implementations as well. Ew, good catch. :P -- Kees Cook