From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from shards.monkeyblade.net ([184.105.139.130]:50104 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832AbeCOSmL (ORCPT ); Thu, 15 Mar 2018 14:42:11 -0400 Date: Thu, 15 Mar 2018 14:42:10 -0400 (EDT) Message-Id: <20180315.144210.1170859529847416311.davem@davemloft.net> To: john.fastabend@gmail.com Cc: ast@kernel.org, daniel@iogearbox.net, davejwatson@fb.com, netdev@vger.kernel.org Subject: Re: [bpf-next PATCH v2 08/18] bpf: sk_msg program helper bpf_sk_msg_pull_data From: David Miller In-Reply-To: <20180312192345.8039.27774.stgit@john-Precision-Tower-5810> References: <20180312192034.8039.70022.stgit@john-Precision-Tower-5810> <20180312192345.8039.27774.stgit@john-Precision-Tower-5810> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: From: John Fastabend Date: Mon, 12 Mar 2018 12:23:45 -0700 > Currently, if a bpf sk msg program is run the program > can only parse data that the (start,end) pointers already > consumed. For sendmsg hooks this is likely the first > scatterlist element. For sendpage this will be the range > (0,0) because the data is shared with userspace and by > default we want to avoid allowing userspace to modify > data while (or after) BPF verdict is being decided. > > To support pulling in additional bytes for parsing use > a new helper bpf_sk_msg_pull(start, end, flags) which > works similar to cls tc logic. This helper will attempt > to point the data start pointer at 'start' bytes offest > into msg and data end pointer at 'end' bytes offset into > message. ... > Signed-off-by: John Fastabend Yeah this looks really nice. Acked-by: David S. Miller