Project

General

Profile

Feature #13103

[PATCH] random.c: use "__NR_" syscall prefix on Linux (instead of "SYS_")

Added by normalperson (Eric Wong) over 2 years ago. Updated over 2 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:78972]

Description

[PATCH] random.c (fill_random_bytes_syscall): use "_NR" prefix on Linux

glibc still does not define the SYS_getrandom alias for
__NR_getrandom in the Linux kernel. However, installing
up-to-date Linux kernel headers (linux-libc-dev >= 3.17 package
on Debian) will get the __NR_getrandom syscall number defined
properly without relying on glibc.

This allows users with a modern kernel+headers to use the getrandom
syscall without waiting on glibc support.


Files

History

Updated by normalperson (Eric Wong) over 2 years ago

normalperson@yhbt.net wrote:


Feature #13103: [PATCH] random.c: use "_NR" syscall prefix on Linux (instead of "SYS_")
https://bugs.ruby-lang.org/issues/13103

Any comments? I may commit, someday...

Updated by kosaki (Motohiro KOSAKI) over 2 years ago

SYS_getrandom and __NR_getrandom are defined in different headers. but your patch doesn't change any #include directive. It seems odd.

Anyway I have no objection.

Updated by normalperson (Eric Wong) over 2 years ago

kosaki.motohiro@gmail.com wrote:

SYS_getrandom and __NR_getrandom are defined in different headers. but
your patch doesn't change any #include directive. It seems odd.

Yes. sys/syscall.h (glibc, libc6-dev on Debian) pulls in
asm/unistd_#{ARCH}.h (provided by Linux kernel headers,
linux-libc-dev on Debian) where NR_* is defined.

Anyway I have no objection.

Thanks, r57307

Also available in: Atom PDF