From owner-freebsd-net@FreeBSD.ORG Wed Dec 28 15:57:31 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50517106566C; Wed, 28 Dec 2011 15:57:31 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.friendlyhosting.spb.ru (onlyone.friendlyhosting.spb.ru [IPv6:2a01:4f8:131:60a2::2]) by mx1.freebsd.org (Postfix) with ESMTP id DAD8C8FC18; Wed, 28 Dec 2011 15:57:30 +0000 (UTC) Received: from lion.home.serebryakov.spb.ru (unknown [IPv6:2001:470:923f:1:3df3:fd3e:2c60:3d1d]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.friendlyhosting.spb.ru (Postfix) with ESMTPA id A432D4AC32; Wed, 28 Dec 2011 19:57:28 +0400 (MSK) Date: Wed, 28 Dec 2011 19:57:25 +0400 From: Lev Serebryakov Organization: FreeBSD Project X-Priority: 3 (Normal) Message-ID: <1742895255.20111228195725@serebryakov.spb.ru> To: Luigi Rizzo In-Reply-To: <20111228104251.GB74183@onelab2.iet.unipi.it> References: <1498545030.20111227015431@nitronet.pl> <4EF9ADBC.8090402@FreeBSD.org> <4EFA3F6F.9040404@sentex.net> <4EFA40D7.60206@FreeBSD.org> <444957640.20111228102844@serebryakov.spb.ru> <20111228104251.GB74183@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable Cc: Pawel Tyll , Adrian Chadd , Lev Serebryakov , "Alexander V. Chernikov" , Mike Tancsa , freebsd-net@freebsd.org, freebsd-ipfw@freebsd.org Subject: Re: Firewall Profiling. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: lev@FreeBSD.org List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2011 15:57:31 -0000 Hello, Luigi. You wrote 28 =E4=E5=EA=E0=E1=F0=FF 2011 =E3., 14:42:51: > There is a problem here. You have to trust the native code > before allowing its execution in the kernel. So either you root could load any KLD. So, I think, we could trust any code "uploaded" via setsocopt()... Yes, it looks dangerous, but, again, if root is compromised, attacker could compile and load kernel module as well. > implement some form of sandboxing or code validator > before accepting a blob of native code from the setsockopt(), > or you generate the code directly within the kernel. > But with these sizes you cannot embed clang or gcc in the kernel: clang is bad example, it needs to process C/C++ code (frontend). Custom-written compiler with LLVM as backend could have very reasonable size. But not for kernel side, for sure, in any case! > though i would guess that a custom code generator is probably simpler > to write (perhaps reusing sys/i386/i386/bpf_jit_machdep.c and its > amd64 counterpart) Yep, as we have BPF JIT, it could be simpler. --=20 // Black Lion AKA Lev Serebryakov