Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Apr 2000 07:32:58 -0700 (PDT)
From:      Murray Stokely <murray@cdrom.com>
To:        freebsd-hackers@freebsd.org
Subject:   image_params.fname
Message-ID:  <Pine.BSF.4.10.10004130728300.23566-100000@pike.cdrom.com>

next in thread | raw e-mail | index | archive | help
  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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10004130728300.23566-100000>