Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 28 Jan 2015 13:26:41 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: getrandom syscall

* Daniel Cegie??ka <daniel.cegielka@...il.com> [2015-01-28 10:10:53 +0100]:
> 2015-01-28 10:02 GMT+01:00 Szabolcs Nagy <nsz@...t70.net>:
> >
> > #ifdef SYS_getrandom
...
> > #endif
> >
> > eg sh does not have the syscall (linux is not consistent with
> > syscalls for whatever reason)
> 
> SYS_getrandom is defined on musl, so #ifdef SYS_getrandom is not a
> good solution:
> 
> http://git.musl-libc.org/cgit/musl/tree/arch/x86_64/bits/syscall.h#n657
> 
> It's better to return an error.

no

you should return runtime error if the syscall fails
(eg you are on old kernel that does not support the syscall)

but you cannot use this code if SYS_getrandom is not
defined (eg. sh arch) because it will be a musl
compile time failure (sadly linux does not allocate
syscall numbers on all archs so musl cannot define
all SYS_ macros consistently on all archs either)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.