Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1390252ybh; Thu, 23 Jul 2020 07:45:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9dtAjH+NxGStAkuxz0Z8be4Cofj+SfU7b9t8wseG8C07aeLXhPSHCUVY+mVUZ6IaoakaL X-Received: by 2002:a17:906:60c6:: with SMTP id f6mr4421608ejk.265.1595515552018; Thu, 23 Jul 2020 07:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595515552; cv=none; d=google.com; s=arc-20160816; b=jwQfIEJbc18gD6yfCY65stox8su8oCLRffxSOnMZDE4xL1RcfiIqMCslucUEo7YdiZ Sq0dPiEQcNjZvSH4HXqjHbSTql0UTNb5Dz/JGHz7W2EUEo7Vv4rq/JdtLfOGvLs4yB43 yC0chpgcp9k6ZILx1+lFCqzlZdRqx1O4WJhoUBwC47tSuyHYAGGlA+hv0ZJG8mC+c+k/ IOExF4PgIp6BOI2akEXAbh6D4yVNLv/NQp3Rgw3PJQ4QI2zAPerwsMbbgUm6YuDd5jTI 7as2LE6H1x2LN2msrSJP/Oi6RIl7Us1zkZmQH1HyUQ0LE47uiZ5G3ALn/xMgNlOixGqf bQLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=G3savEfEccfuQd6Qhhpy63ZGqMfJYcQKrBALOI8lrK0=; b=vdr6W+oXyNgpxUrH0g7QACJ4w4bu5fSftnvFA+mFYOlXqVq7DaK9wYp5OGwhAi/kjy FgZB/LEavHfFrCW01lbi6pSl0l3HEopEP18nG4EDv4L+Q9iRjqDT65XyyQr2UKSPS1YM jO5cw7q243O+4Z+HuErAC14qkybuuPhp7qRNluaHuPuC9bBTr4xJqyR+SmX9K2DeTgsf 17ZCbwHY4UKMcQxYQiL5fB8fKBlDeU84CLjYDWBmS2d6wL8CMN/5gfsr9XnvBi9toQNl kY+zwogf7rI596LvsVpqMrIomW35nTmw8a2MmWnPikd/b1e5T7dwrjtQoiFH4w3mDbvM KeEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy13si2054477edb.388.2020.07.23.07.45.14; Thu, 23 Jul 2020 07:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728870AbgGWOpD (ORCPT + 99 others); Thu, 23 Jul 2020 10:45:03 -0400 Received: from verein.lst.de ([213.95.11.211]:60533 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726761AbgGWOpC (ORCPT ); Thu, 23 Jul 2020 10:45:02 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 7138C68AFE; Thu, 23 Jul 2020 16:44:55 +0200 (CEST) Date: Thu, 23 Jul 2020 16:44:55 +0200 From: 'Christoph Hellwig' To: David Laight Cc: 'Christoph Hellwig' , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Alexey Kuznetsov , Hideaki YOSHIFUJI , Eric Dumazet , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" , "netfilter-devel@vger.kernel.org" , "coreteam@netfilter.org" , "linux-sctp@vger.kernel.org" , "linux-hams@vger.kernel.org" , "linux-bluetooth@vger.kernel.org" , "bridge@lists.linux-foundation.org" , "linux-can@vger.kernel.org" , "dccp@vger.kernel.org" , "linux-decnet-user@lists.sourceforge.net" , "linux-wpan@vger.kernel.org" , "linux-s390@vger.kernel.org" , "mptcp@lists.01.org" , "lvs-devel@vger.kernel.org" , "rds-devel@oss.oracle.com" , "linux-afs@lists.infradead.org" , "tipc-discussion@lists.sourceforge.net" , "linux-x25@vger.kernel.org" Subject: Re: [PATCH 03/26] bpfilter: reject kernel addresses Message-ID: <20200723144455.GA12280@lst.de> References: <20200723060908.50081-1-hch@lst.de> <20200723060908.50081-4-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2020 at 02:42:11PM +0000, David Laight wrote: > From: Christoph Hellwig > > Sent: 23 July 2020 07:09 > > > > The bpfilter user mode helper processes the optval address using > > process_vm_readv. Don't send it kernel addresses fed under > > set_fs(KERNEL_DS) as that won't work. > > What sort of operations is the bpf filter doing on the sockopt buffers? > > Any attempts to reject some requests can be thwarted by a second > application thread modifying the buffer after the bpf filter has > checked that it allowed. > > You can't do security by reading a user buffer twice. I'm not saying that I approve of the design, but the current bpfilter design uses process_vm_readv to access the buffer, which obviously does not work with kernel buffers.