From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6887 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: getrandom syscall Date: Wed, 28 Jan 2015 13:26:41 +0100 Message-ID: <20150128122640.GF32318@port70.net> References: <20150128090212.GE32318@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1422448021 10605 80.91.229.3 (28 Jan 2015 12:27:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Jan 2015 12:27:01 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6900-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 28 13:27:00 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YGRhv-0005s7-EM for gllmg-musl@m.gmane.org; Wed, 28 Jan 2015 13:26:55 +0100 Original-Received: (qmail 19708 invoked by uid 550); 28 Jan 2015 12:26:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19694 invoked from network); 28 Jan 2015 12:26:52 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:6887 Archived-At: * Daniel Cegie??ka [2015-01-28 10:10:53 +0100]: > 2015-01-28 10:02 GMT+01:00 Szabolcs Nagy : > > > > #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)