linux_pipe does not preserve the edx register. Linux and

programs using glibc expect edx to be preserved accross syscalls.
As a result, linux programs running in emulation mode can
have whatever value may be represented by edx clobbered.

PR:		9038
Submitted-By:	Richard Seaman, Jr. <dick@tar.com>
This commit is contained in:
Jordan K. Hubbard 1998-12-10 13:47:18 +00:00
parent ad06d8fc41
commit 57da30bfc9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41650
2 changed files with 24 additions and 6 deletions

View file

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_misc.c,v 1.45 1998/10/05 12:40:42 sos Exp $
* $Id: linux_misc.c,v 1.46 1998/12/04 22:54:50 archie Exp $
*/
#include <sys/param.h>
@ -659,14 +659,23 @@ int
linux_pipe(struct proc *p, struct linux_pipe_args *args)
{
int error;
int reg_edx;
#ifdef DEBUG
printf("Linux-emul(%d): pipe(*)\n", p->p_pid);
#endif
if (error = pipe(p, 0))
reg_edx = p->p_retval[1];
if (error = pipe(p, 0)) {
p->p_retval[1] = reg_edx;
return error;
if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int)))
}
if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int))) {
p->p_retval[1] = reg_edx;
return error;
}
p->p_retval[1] = reg_edx;
p->p_retval[0] = 0;
return 0;
}

View file

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_misc.c,v 1.45 1998/10/05 12:40:42 sos Exp $
* $Id: linux_misc.c,v 1.46 1998/12/04 22:54:50 archie Exp $
*/
#include <sys/param.h>
@ -659,14 +659,23 @@ int
linux_pipe(struct proc *p, struct linux_pipe_args *args)
{
int error;
int reg_edx;
#ifdef DEBUG
printf("Linux-emul(%d): pipe(*)\n", p->p_pid);
#endif
if (error = pipe(p, 0))
reg_edx = p->p_retval[1];
if (error = pipe(p, 0)) {
p->p_retval[1] = reg_edx;
return error;
if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int)))
}
if (error = copyout(p->p_retval, args->pipefds, 2*sizeof(int))) {
p->p_retval[1] = reg_edx;
return error;
}
p->p_retval[1] = reg_edx;
p->p_retval[0] = 0;
return 0;
}