Cross Memory Attach issue?

S

Sss

Guest
I’ve found some limitation of this mechanism and suspect that’s Linux kernel bug – syscall process_vm_readv cannot read more than 2147479552 bytes

Linux 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 513627
max locked memory (kbytes, -l) 4000000
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited


That’s easy to reproduce:

int
main (int argc, char *argv[]) {

int i;
char *premote_buf,*plocal_buf;
size_t len;
pid_t pid;
ssize_t nread;
struct iovec local[1];
struct iovec remote[1];
int sync_flag;

pid=getpid();

for ( len=(size_t)(1*1024*1024)*(1024); len <= (size_t)(4*1024*1024)*(1024) ; len*=2 ) {

plocal_buf=malloc(len);
memset(plocal_buf,0,len);
premote_buf=malloc(len);
memset(premote_buf,0,len);
local[0].iov_base = plocal_buf;
local[0].iov_len = len;
remote[0].iov_base = premote_buf;
remote[0].iov_len = len;

nread = process_vm_readv(pid, local, 1, remote, 1, 0);

if ( nread != len ) {
printf("Reading of %lld fails: nread=%lld errno=%d \n",len,nread,errno);
exit(-1);
}
printf("Reading of %lld done\n",len);

free(plocal_buf);
}
return(0);
}
Output:
Reading of 1073741824 done
Reading of 2147483648 fails: nread=2147479552 errno=0


The latest stable Kernel 3.16.1 demonstrates the same behavior.
Did anybody see such behavior before? Is that really a bug?

If so, what is the right way to escalate is and get fixed?
 

Members online


Latest posts

Top