Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Sep 2019 16:03:26 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352015 - head/sys/kern
Message-ID:  <201909071603.x87G3QiN004602@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Sep  7 16:03:26 2019
New Revision: 352015
URL: https://svnweb.freebsd.org/changeset/base/352015

Log:
  When loading ELF interpreter, initialize whole nested image_params with zero.
  
  Otherwise we could mishandle imgp->textset.
  
  Reviewed by:	markj
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D21560

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c	Sat Sep  7 16:01:45 2019	(r352014)
+++ head/sys/kern/imgact_elf.c	Sat Sep  7 16:03:26 2019	(r352015)
@@ -733,7 +733,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_
 		return (ECAPMODE);
 #endif
 
-	tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK);
+	tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK | M_ZERO);
 	nd = &tempdata->nd;
 	attr = &tempdata->attr;
 	imgp = &tempdata->image_params;
@@ -743,10 +743,6 @@ __elfN(load_file)(struct proc *p, const char *file, u_
 	 */
 	imgp->proc = p;
 	imgp->attr = attr;
-	imgp->firstpage = NULL;
-	imgp->image_header = NULL;
-	imgp->object = NULL;
-	imgp->execlabel = NULL;
 
 	NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF,
 	    UIO_SYSSPACE, file, curthread);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909071603.x87G3QiN004602>