PERFORCE change 126891 for review

Peter Wemm peter at FreeBSD.org
Thu Sep 27 15:20:58 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126891

Change 126891 by peter at peter_daintree on 2007/09/27 22:20:51

	WIP - attempt to fall back from ld-elf32.so.1 to ld-elf.so.1

Affected files ...

.. //depot/projects/hammer/sys/kern/imgact_elf.c#41 edit

Differences ...

==== //depot/projects/hammer/sys/kern/imgact_elf.c#41 (text+ko) ====

@@ -605,7 +605,7 @@
 	u_long seg_size, seg_addr;
 	u_long addr, entry = 0, proghdr = 0;
 	int error = 0, i;
-	const char *interp = NULL;
+	const char *interp = NULL, *newinterp = NULL;
 	Elf_Brandinfo *brand_info;
 	char *path;
 	struct thread *td = curthread;
@@ -654,7 +654,7 @@
 		return (ENOEXEC);
 	sv = brand_info->sysvec;
 	if (interp != NULL && brand_info->interp_newpath != NULL)
-		interp = brand_info->interp_newpath;
+		newinterp = brand_info->interp_newpath;
 
 	/*
 	 * Avoid a possible deadlock if the current address space is destroyed
@@ -786,6 +786,7 @@
 	imgp->entry_addr = entry;
 
 	if (interp != NULL) {
+		int have_interp = FALSE;
 		VOP_UNLOCK(imgp->vp, 0, td);
 		if (brand_info->emul_path != NULL &&
 		    brand_info->emul_path[0] != '\0') {
@@ -796,9 +797,14 @@
 			    &imgp->entry_addr, sv->sv_pagesize);
 			free(path, M_TEMP);
 			if (error == 0)
-				interp = NULL;
+				have_interp = TRUE;
+		}
+		if (!have_interp && newinterp != NULL) {
+			error = __elfN(load_file)(imgp->proc, newinterp, &addr,
+			    &imgp->entry_addr, sv->sv_pagesize);
+			have_interp = TRUE;
 		}
-		if (interp != NULL) {
+		if (!have_interp) {
 			error = __elfN(load_file)(imgp->proc, interp, &addr,
 			    &imgp->entry_addr, sv->sv_pagesize);
 		}


More information about the p4-projects mailing list