From owner-freebsd-hackers Thu Apr 13 7:30:41 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from pike.cdrom.com (pike.cdrom.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id C36E637BD51 for ; Thu, 13 Apr 2000 07:30:37 -0700 (PDT) (envelope-from murray@cdrom.com) Received: from localhost (murray@localhost) by pike.cdrom.com (8.9.1a/8.9.1) with ESMTP id HAA25297 for ; Thu, 13 Apr 2000 07:32:58 -0700 (PDT) Date: Thu, 13 Apr 2000 07:32:58 -0700 (PDT) From: Murray Stokely To: freebsd-hackers@freebsd.org Subject: image_params.fname Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm having trouble displaying the value of image_params->fname in this small snippet of code from imgact_elf.c. When the system execs an unbranded elf binary it doesn't tell you the name of the actual file that you tried to exec, which can be very annoying when you run an obfuscated shell-installer for a Linux application. Anyway this code always ends up with nonsense in the path; what am I doing wrong? if (brand_info == NULL) { if (brand[0] == 0) { uprintf("ELF binary type not known." " Use \"brandelf\" to brand it.\n"); uprintf("imgp->fname : %p\n",imgp->fname); /* user space */ uprintf("fname : %p\n",&path[0]); /* kernel space */ error = copyinstr(imgp->fname,&path[0],MAXPATHLEN,&length); if (!error) { uprintf("Filename : '%s'\n",path); uprintf("length : %d\n",length); } } $ ./Mathematica ELF binary type not known. Use "brandelf" to brand it. imgp->fname : 0x80a6a00 fname : 0xc0d39800 Filename :j length : 3 Abort - Murray To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message