From nobody@FreeBSD.org  Mon Feb  6 12:54:00 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3D5F816A420
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  6 Feb 2006 12:54:00 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0BD5043D45
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  6 Feb 2006 12:54:00 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k16Crxio078250
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 6 Feb 2006 12:53:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k16Crxj0078249;
	Mon, 6 Feb 2006 12:53:59 GMT
	(envelope-from nobody)
Message-Id: <200602061253.k16Crxj0078249@www.freebsd.org>
Date: Mon, 6 Feb 2006 12:53:59 GMT
From: Menshutin Anton <may@chg.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: xdr double buffer overflow
X-Send-Pr-Version: www-2.3

>Number:         92889
>Category:       amd64
>Synopsis:       [libc] xdr double buffer overflow
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 06 13:00:14 GMT 2006
>Closed-Date:    Fri May 09 14:46:57 UTC 2008
>Last-Modified:  Fri May 09 14:46:57 UTC 2008
>Originator:     Menshutin Anton
>Release:        5.4 amd64
>Organization:
ITP
>Environment:
FreeBSD ***.***.ru 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Thu Nov 24 13:33:07 UTC 2005  ***@***.***.ru:/usr/src/sys/amd64/compile/SMP  amd64
>Description:
Problem in xdr functions from libc on amd64. Sending doubles or floats
with pvm library causes out of range access in receiving program. First
4 bytes of double are being received correctly (when sending from i386
machine) but the last 4 bytes come to the wrong place, owerwriting 4 bytes
memory AFTER the double. Seems to be a problem with libc xdr packing/
unpacking functions.                
>How-To-Repeat:
Write a simple test program sending double from one host to another.           

//test_pvm.c
#include <stdio.h>
#include "pvm3.h"
char *hostname="localhost"; //hostname where to run slave
char buf[1024];
int main()
{
  int tid;
  pvm_catchout(stdout);
  pvm_spawn("test_pvm_slave",NULL,PvmTaskHost,
      hostname,1,&tid);
  pvm_initsend(PvmDataDefault);
  double t=0.123;
  double *p;
  int i;
  unsigned int k;
  p=buf;
  *p=t;
  printf("Data before sending:");
  for (i=0;i<16;i++)
  {
    printf("%hhu ",buf[i]);
  }
  printf("\n");
  pvm_pkdouble(p,1,1);
  pvm_send(tid,0);
  pvm_exit();
  return(0);
}
//test_pvm_slave.c
#include "pvm3.h"
#include <stdio.h>
char buf[1024];
int main()
{
  int tid;
  double t=0.123;
  double *p;
  int i;
  fprintf(stderr,"I am slave\n");
  pvm_recv(pvm_parent(),0);
  p=buf;
  pvm_upkdouble(p,1,1);
  t=*p;
  for (i=0;i<16;i++)
  {
    printf("%hhu ",buf[i]);
  }
  printf("\n");
  pvm_exit();
  return(0);
}



>Fix:
              
>Release-Note:
>Audit-Trail:

From: Nate Eldredge <nge@cs.hmc.edu>
To: bug-followup@FreeBSD.org, may@chg.ru
Cc:  
Subject: Re: amd64/92889: [libc] xdr double buffer overflow
Date: Tue, 16 Oct 2007 20:18:37 -0700 (PDT)

 I cannot reproduce this.  I'm using pvm-3.4.5_2 from ports.  I couldn't 
 figure out how to run the master and slave on the same machine, so I ran 
 the master on an i386 Linux box (debian unstable, with pvm 3.4.5-9) and 
 the slave on FreeBSD 6.2-RELEASE-p7/amd64, and master and slave produce 
 the same output.  I also tried sending the data the other way with the 
 same result.
 
 -- 
 Nate Eldredge
 nge@cs.hmc.edu
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Mon May 5 01:54:22 UTC 2008 
State-Changed-Why:  
Note that submitter was asked for feedback quite some time ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92889 

From: Anton Menshutin <may@chg.ru>
To: bug-followup@FreeBSD.org, may@chg.ru
Cc:  
Subject: Re: amd64/92889: [libc] xdr double buffer overflow
Date: Fri, 09 May 2008 13:09:37 +0400

 This bug seems to be already resolved. I tested it under 6.2 and 7.0 and 
 everything seems to be ok now.
 
State-Changed-From-To: feedback->closed 
State-Changed-By: linimon 
State-Changed-When: Fri May 9 14:46:33 UTC 2008 
State-Changed-Why:  
Submitter says that this is now fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=92889 
>Unformatted:
