Do not leak %rdx value in the previous image to the new image after

execve(2). Note that ia32 binaries already handle this properly,
since ia32_setregs() resets td_retval[1], but not exec_setregs().

We still do not conform to the amd64 ABI specification, since %rsp
on the image startup is not aligned to 16 bytes.

PR:	amd64/124134
Discussed with:	Petr Salinger <Petr.Salinger seznam cz>
	(who convinced me that there is indeed several bugs)
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2010-12-06 15:15:27 +00:00
parent 8b08562112
commit 3e0ddb6781

View File

@ -876,6 +876,7 @@ exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
regs->tf_fs = _ufssel;
regs->tf_gs = _ugssel;
regs->tf_flags = TF_HASSEGS;
td->td_retval[1] = 0;
/*
* Reset the hardware debug registers if they were in use.