Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2900343ybd; Mon, 24 Jun 2019 15:01:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqYiOiZNK0g05TUDXYSe74Up1cFAYvI4ywzsLL8KtZYKKzgKxqORkFJUNG+cn3Mc4WFez2 X-Received: by 2002:a17:90a:8a91:: with SMTP id x17mr27499293pjn.95.1561413692040; Mon, 24 Jun 2019 15:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561413692; cv=none; d=google.com; s=arc-20160816; b=rtysSuTPVX6lHk/1PtxY7C6mUEpBKcBqamuT6Sm2NeRCAPmico11DDHHg0BD/17KUM +T+32VQrKqrXnxGGWkW+8IEJFStqdrQHzyVb+NCARu4Xth1RCbPfZG+ct5PtqPuTAL5L FGyCjaPAkZtdouxLC2s59jfaQ6Tz4HW07pBqf2zD4VCRUiWHF+/qm7JHU/0MADwDUT69 j8dxW6HPw7qiFF4QL4uQo1jzpfH6SgJPER4brV/CJG6fmYH22uq14JLrLFm8Af5CwwPe MXj0j2N+1/YTNdQ766Csuelo2/YGogtAE9yU4t4ROXjVSLNBAgZXPej0dLBshua3PZ03 mY5Q== 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=PCO99XRBcTMk7xPOe+2jF9BM4ai4WuGZIMwzESZmoFE=; b=AYUaup8PFV93qCOtaOiQqO0RP2veTFnuMeOKBIzYfvIcH57bdeqKtPAgZMNFp4i00j l3vQ42GmegruVJou0xm4QZ+G6oqPvicHr8kjLAxStM30SC39/THvs0bg9fxE9g3ZYJUY 6HUClcwIbcVRHkmcGUuuTpmRppV5shErXGajxAgUbk2kQCubJEOq0EfvwgM4P8yVkVat adrwJJo+e500Q1HrEAWbtkQtNRB2XwGWDIAgJPS6Ft+vp04fiPm4B/gXnxfVUfrjALyl U6oVJQl/D9PUcV2X3yUXNcfoRfGd1cQPlQT3EY0e3BFPKEFSrrG2ZRvYX9c7YA7S/FfQ HJBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y1IekffK; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m127si7928307pgm.594.2019.06.24.15.01.16; Mon, 24 Jun 2019 15:01:32 -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=@kernel.org header.s=default header.b=Y1IekffK; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731513AbfFXUI7 (ORCPT + 99 others); Mon, 24 Jun 2019 16:08:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:44256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731486AbfFXUI6 (ORCPT ); Mon, 24 Jun 2019 16:08:58 -0400 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8047B208E3 for ; Mon, 24 Jun 2019 20:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561406937; bh=yZharV4FdSmnh4ESX5hlMEMyGkbzv5g/opBE0Yc/f0I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Y1IekffKS026ESmMRLJsvztz8MSob/Ro0R6FERAq9Bq0/tiEEnb1wPvsYvLv+gzeS jf0ST/tsLNz4FT7mGomzddkDvyOyMhn2cbgylD5MqpFhElQOlY99iS+3k+lQfAomRo uJkLnM6Rt8Zt/0bzPwQM9DU0YlHQnU8lKav0D2pc= Received: by mail-wm1-f44.google.com with SMTP id x15so552312wmj.3 for ; Mon, 24 Jun 2019 13:08:57 -0700 (PDT) X-Gm-Message-State: APjAAAUs92aXO1a89Endi8Ly5A+Zb8/cHskfQvHWCtl2nTuBavFuI1tf j+QGbApOuVwEBT1loI+pzZvPSpCg0audizhLHCi/7Q== X-Received: by 2002:a7b:cd84:: with SMTP id y4mr17194362wmj.79.1561406935987; Mon, 24 Jun 2019 13:08:55 -0700 (PDT) MIME-Version: 1.0 References: <20190622000358.19895-1-matthewgarrett@google.com> <20190622000358.19895-24-matthewgarrett@google.com> <739e21b5-9559-d588-3542-bf0bc81de1b2@iogearbox.net> In-Reply-To: From: Andy Lutomirski Date: Mon, 24 Jun 2019 13:08:44 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V34 23/29] bpf: Restrict bpf when kernel lockdown is in confidentiality mode To: Matthew Garrett Cc: Daniel Borkmann , James Morris , LSM List , Linux Kernel Mailing List , Linux API , David Howells , Alexei Starovoitov , Network Development , Chun-Yi Lee , Jann Horn , bpf@vger.kernel.org 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, Jun 24, 2019 at 12:54 PM Matthew Garrett wrote: > > On Mon, Jun 24, 2019 at 8:37 AM Daniel Borkmann wrote: > > > > On 06/22/2019 02:03 AM, Matthew Garrett wrote: > > > From: David Howells > > > > > > There are some bpf functions can be used to read kernel memory: > > > > Nit: that > > Fixed. > > > > bpf_probe_read, bpf_probe_write_user and bpf_trace_printk. These allow > > > > Please explain how bpf_probe_write_user reads kernel memory ... ?! > > Ha. > > > > private keys in kernel memory (e.g. the hibernation image signing key) to > > > be read by an eBPF program and kernel memory to be altered without > > > > ... and while we're at it, also how they allow "kernel memory to be > > altered without restriction". I've been pointing this false statement > > out long ago. > > Yup. How's the following description: > > bpf: Restrict bpf when kernel lockdown is in confidentiality mode > > There are some bpf functions that can be used to read kernel memory and > exfiltrate it to userland: bpf_probe_read, bpf_probe_write_user and > bpf_trace_printk. These could be abused to (eg) allow private > keys in kernel > memory to be leaked. Disable them if the kernel has been locked > down in confidentiality > mode. I'm confused. I understand why we're restricting bpf_probe_read(). Why are we restricting bpf_probe_write_user() and bpf_trace_printk(), though? --Andy