public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Leo Liang <ycliang@andestech.com>
Cc: <libc-help@sourceware.org>,
	 peterlin@andestech.com, dylan@andestech.com,
	 alankao@andestech.com
Subject: Re: Is it reasonable to expect errno to be 0 when entering main?
Date: Tue, 27 Sep 2022 08:05:20 +0200	[thread overview]
Message-ID: <87mtalz71b.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <YzGWAjzz2OhxKTGL@ubuntu01> (Leo Liang's message of "Mon, 26 Sep 2022 12:07:30 +0000")

* Leo Liang:

> If the above program is statically-linked, and if the program is executed before "crng init done",
> the errno will not be zero when entering main.
>
> There seems to be syscall (__getrandom) before main is entered,
> and if the crng is not initialized, the syscall will fail causing the errno to be set.
> (_dl_get_origin -> __libc_malloc -> ptmalloc_init -> tcache_key_initialize -> __getrandom)
>
> So we are wondering if we should set errno to zero before entering main.

This is a bug.  It only affects static linking.  Would you please file
it in Bugzilla?  Thanks.

  reply	other threads:[~2022-09-27  6:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 12:07 Leo Liang
2022-09-27  6:05 ` Florian Weimer [this message]
2022-09-27  7:15   ` Leo Liang
2022-09-27  7:31     ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtalz71b.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=alankao@andestech.com \
    --cc=dylan@andestech.com \
    --cc=libc-help@sourceware.org \
    --cc=peterlin@andestech.com \
    --cc=ycliang@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).