From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 5 01:15:49 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8BD7016A4DA for ; Wed, 5 Jul 2006 01:15:49 +0000 (UTC) (envelope-from artifact.one@googlemail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2BE143D45 for ; Wed, 5 Jul 2006 01:15:48 +0000 (GMT) (envelope-from artifact.one@googlemail.com) Received: by ug-out-1314.google.com with SMTP id e2so1443577ugf for ; Tue, 04 Jul 2006 18:15:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pXnW6iYWdIsIW+VqYtCS3cnOiKUzzLdg+elO3K54hBnT6DQ1r5i1aM9iKwb4Z6Jxl6bhg/FOtWKXuGVuJuekPZZzwnBpxyUfdkirXA/zBd8oWvJ72b97ROfnm1HpN8QL2Ln0KnE4CVjpQNcavXorugFDVTmE2LY1h1X+pQpmfcI= Received: by 10.78.151.3 with SMTP id y3mr1526260hud; Tue, 04 Jul 2006 18:15:45 -0700 (PDT) Received: by 10.78.43.9 with HTTP; Tue, 4 Jul 2006 18:15:44 -0700 (PDT) Message-ID: <8e96a0b90607041815s7888cf7areb5244247b9bdb53@mail.gmail.com> Date: Wed, 5 Jul 2006 02:15:44 +0100 From: "mal content" To: "Peter Jeremy" In-Reply-To: <20060703190448.GD727@turion.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <8e96a0b90607031009v4ec2630fgfc432f5dad15abda@mail.gmail.com> <20060703190448.GD727@turion.vk2pj.dyndns.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Stop further socket() or connect() calls. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2006 01:15:49 -0000 On 03/07/06, Peter Jeremy wrote: > For dynamic executables, you could LD_PRELOAD a .so that replaces > all the socket-related syscalls. Excellent suggestion! Ok, I've created a basic .so file with the following code, but I've basically got stuck because I don't know how the original syscalls are defined and can't find the definitions in the source: --- #include #include #include int socket(int d, int t, int prot) { return __syscall(SYS_socket, d, t, prot); } int connect(int s, const struct sockaddr *sa, socklen_t len) { return __syscall(SYS_connect, s, sa, len); } int bind(int s, const struct sockaddr *sa, socklen_t len) { return __syscall(SYS_bind, s, sa, len); } int listen(int s, int bl) { return __syscall(SYS_listen, s, bl); } --- This doesn't work, it causes various runtime errors. Where are the system calls defined in the source? I could just copy the definitions. cheers MC