From owner-freebsd-net@FreeBSD.ORG Sun Aug 4 19:55:40 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BA9129AE for ; Sun, 4 Aug 2013 19:55:40 +0000 (UTC) (envelope-from rmind@netbsd.org) Received: from mail.netbsd.org (mail.NetBSD.org [IPv6:2001:4f8:3:7::25]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A70A92762 for ; Sun, 4 Aug 2013 19:55:40 +0000 (UTC) Received: from ws (localhost [IPv6:::1]) by mail.netbsd.org (Postfix) with SMTP id C87A614A135; Sun, 4 Aug 2013 19:55:38 +0000 (UTC) Date: Sun, 4 Aug 2013 20:55:18 +0100 From: Mindaugas Rasiukevicius To: Rui Paulo Subject: Re: BPF_MISC+BPF_COP and BPF_COPX In-Reply-To: <9813E50B-C557-4FE1-BADF-A2CFFCBB8BD7@felyko.com> References: <20130804191310.2FFBB14A152@mail.netbsd.org> <9813E50B-C557-4FE1-BADF-A2CFFCBB8BD7@felyko.com> X-Mailer: mail(1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20130804195538.C87A614A135@mail.netbsd.org> Cc: tech-net@netbsd.org, guy@alum.mit.edu, freebsd-net@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Aug 2013 19:55:40 -0000 Rui Paulo wrote: > > > > Comments? > > > Why do you need this in the first place? It provides us a capability to offload more complex packet processing. My primary user would be NPF in NetBSD, e.g. one of the operations is to lookup an IP address in a table/ipset. > Are you sure this is a safe design? Adding this functionality to BPF > makes me a little nervous as an error in the implementation leads to > kernel code execution (I could be able to call random kernel functions). This is functionality is for a custom use of BPF. There would be no coprocessor by default and the instruction would essentially be a NOP. Perhaps I was not clear on bpf_set_cop(9) - it is a kernel routine, so the user would be a kernel subsystem which has a full control over the functions it provides. The functions are predetermined, not random. -- Mindaugas