From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 16 12:13:22 2003 Return-Path: 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 09C0E16A4CE for ; Sun, 16 Nov 2003 12:13:22 -0800 (PST) Received: from istanbul.enderunix.org (freefall.marmara.edu.tr [193.140.143.23]) by mx1.FreeBSD.org (Postfix) with SMTP id 159D843FBF for ; Sun, 16 Nov 2003 12:13:20 -0800 (PST) (envelope-from murat@enderunix.org) Received: (qmail 26746 invoked by uid 1002); 16 Nov 2003 20:13:23 -0000 Date: Sun, 16 Nov 2003 22:13:23 +0200 From: Murat Balaban To: Kai Zhu Message-ID: <20031116201323.GA26716@enderunix.org> References: <20031116155330.42894.qmail@web21409.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031116155330.42894.qmail@web21409.mail.yahoo.com> cc: freebsd-hackers@freebsd.org Subject: Re: Questions on intercepting execve syscall X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2003 20:13:22 -0000 Hi, It might be that you have some bad address in the execve index of sysent array. See http://www.enderunix.org/murat/linux_subexec/linux_subexec.c for a simple example. PS: don't mind the naming :). On Sun, Nov 16, 2003 at 07:53:30AM -0800, Kai Zhu wrote: > Hello all, > > I am writing a KLD module to intercept execve() as following: > > static int my_execve(struct thread *td, struct execve_args *uap) > { > return(execve(td,uap)); > } > > As you can see, I first just want to make sure that my_execve won't affect the original execve, then I will add some new logic in my_execve before returning to execve(). > After kldload with this module, I always get "Bad address" error if I use any command like ls, cd, etc. > > Does anyone know where my problem is? Thanks! > > > --------------------------------- > Do you Yahoo!? > Protect your identity with Yahoo! Mail AddressGuard > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- "When all else fails, read the instructions -- Murphy's Technology Laws" Murat Balaban http://www.enderunix.org