Example #1
0
void* read_child_data_checked(struct context *ctx, ssize_t size, uintptr_t addr, ssize_t *read_bytes)
{
	//assert(check_if_mapped(ctx, addr, addr + size));

	void *buf = sys_malloc(size);
	/* if pread fails: do the following:   echo 0 > /proc/sys/kernel/yama/ptrace_scope */
	*read_bytes = checked_pread(ctx,buf,size,addr);

	return buf;
}
Example #2
0
 void refill()
 {
     size32_t left = remaining();
     memmove(buffer,ptr,left);
     size32_t rd=bufSize-left;
     if (endpos-nextbufpos<(offset_t)rd)
         rd = (size32_t)(endpos-nextbufpos);
     if (rd) 
         rd = checked_pread(fh, buffer+left, rd, nextbufpos);
     nextbufpos += rd;
     bytesInBuffer = left+rd;
     ptr = buffer;
 }
Example #3
0
void* read_child_data(struct context *ctx, ssize_t size, uintptr_t addr)
{
	void *buf = sys_malloc(size);
	/* if pread fails: do the following:   echo 0 > /proc/sys/kernel/yama/ptrace_scope */
	ssize_t read_bytes = checked_pread(ctx,buf,size,addr);
	if (read_bytes != size) {
		free(buf);
		buf = read_child_data_tid(ctx->child_tid,size,addr);
		printf("reading from: %x demanded: %u  read %u  event: %d\n", addr, size, read_bytes, ctx->event);
		perror("warning: reading from child process: ");
		printf("try the following: echo 0 > /proc/sys/kernel/yama/ptrace_scope\n");
		sleep(5);
	}

	return buf;
}