From 0234691abb87288f099114a76a3691edb0404a34 Mon Sep 17 00:00:00 2001 From: uebayasi Date: Tue, 19 Aug 2014 10:01:50 +0000 Subject: [PATCH] ld.so(1): Missing stack var initialization Explicitly zero-clear stack array to read dynamic segments. This code has been working because stack is mapped as anon and zero'ed right after execve(2). Found by work-in-progress Valgrind port for OpenBSD/amd64. OK millert@ guenther@ --- libexec/ld.so/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/ld.so/boot.c b/libexec/ld.so/boot.c index 5c2843e5b5f..536f4f593b3 100644 --- a/libexec/ld.so/boot.c +++ b/libexec/ld.so/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.2 2014/07/06 17:33:10 otto Exp $ */ +/* $OpenBSD: boot.c,v 1.3 2014/08/19 10:01:50 uebayasi Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -115,6 +115,7 @@ _dl_boot_bind(const long sp, long *dl_data, Elf_Dyn *dynamicp) #else dynp = (Elf_Dyn *)((long)_DYNAMIC + loff); #endif + _dl_memset(dynld.Dyn.info, 0, sizeof(dynld.Dyn.info)); while (dynp != NULL && dynp->d_tag != DT_NULL) { if (dynp->d_tag < DT_NUM) dynld.Dyn.info[dynp->d_tag] = dynp->d_un.d_val; -- 2.20.1