search for: sys_getrandom

Displaying 5 results from an estimated 5 matches for "sys_getrandom".

2016 Jul 29
0
getrandom waits for a long time when /dev/random is insufficiently read from
...argv[1]; } for (int i = 0; i < atoi(iters); i++) { int fd; if ((fd = open("/dev/random", O_RDONLY)) == -1) return 2; if (read(fd, buf, 1) != 1) return 3; if (close(fd) == -1) return 4; } if (syscall(SYS_getrandom, buf, 1, gr_flags) != 1) return 5; return 0; } Again, making the buffer size 1 resolves the complaint regarding short reads. With the same command line as my original email, running this in QEMU results in: 1, 2..29: reads all return 1 byte, getrandom pauses for 90-110 secs then ret...
2016 Jul 28
2
getrandom waits for a long time when /dev/random is insufficiently read from
...0; i < atoi(argv[1]); i++) { sleep(1); if ((fd = open("/dev/random", O_RDONLY)) == -1) return 2; if (read(fd, buf, sizeof(buf)) < 1) return 3; if (close(fd) == -1) return 4; } sleep(2); if (syscall(SYS_getrandom, buf, sizeof(buf), 0) == -1) return 5; return 0; } $ qemu-system-x86_64 -nodefaults -machine q35,accel=kvm -nographic -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0 -kernel linux-4.7/arch/x86/boot/bzImage -fsdev local,path="$PWD/root",securi...
2016 Jul 28
2
getrandom waits for a long time when /dev/random is insufficiently read from
...0; i < atoi(argv[1]); i++) { sleep(1); if ((fd = open("/dev/random", O_RDONLY)) == -1) return 2; if (read(fd, buf, sizeof(buf)) < 1) return 3; if (close(fd) == -1) return 4; } sleep(2); if (syscall(SYS_getrandom, buf, sizeof(buf), 0) == -1) return 5; return 0; } $ qemu-system-x86_64 -nodefaults -machine q35,accel=kvm -nographic -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0 -kernel linux-4.7/arch/x86/boot/bzImage -fsdev local,path="$PWD/root",securi...
2016 Jul 29
2
getrandom waits for a long time when /dev/random is insufficiently read from
On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller <smueller at chronox.de> wrote: > And finally, you have a coding error that is very very common but fatal when > reading from /dev/random: you do not account for short reads which implies > that your loop continues even in the case of short reads. > > Fix your code with something like the following: > int read_random(char
2016 Jul 29
2
getrandom waits for a long time when /dev/random is insufficiently read from
On Fri, Jul 29, 2016 at 7:40 AM, Stephan Mueller <smueller at chronox.de> wrote: > And finally, you have a coding error that is very very common but fatal when > reading from /dev/random: you do not account for short reads which implies > that your loop continues even in the case of short reads. > > Fix your code with something like the following: > int read_random(char