Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 1 May 2018 10:10:45 +1000
From: Patrick Oppenlander <>
Subject: Re: Some questions

On Mon, Apr 30, 2018 at 1:16 PM, Rich Felker <> wrote:
> On Mon, Apr 30, 2018 at 12:52:06PM +1000, Patrick Oppenlander wrote:
>> - sigisemptyset uses bss. Could be implemented in a similar fashion to
>> sigemptyset, save bss & would probably be faster.
> Ahh, yes. I wonder if gcc has any way to force const zero objects into
> rodata rather than bss..? In any case memcmp is not an efficient way
> to implement this, so maybe it should be changed.

Doing this:

diff --git a/src/signal/sigisemptyset.c b/src/signal/sigisemptyset.c
index 312c66cf..28f74203 100644
--- a/src/signal/sigisemptyset.c
+++ b/src/signal/sigisemptyset.c
@@ -4,6 +4,6 @@

 int sigisemptyset(const sigset_t *set)
-       static const unsigned long zeroset[_NSIG/8/sizeof(long)];
+       static const unsigned long zeroset[_NSIG/8/sizeof(long)] = {};
        return !memcmp(set, &zeroset, _NSIG/8);

Makes it go into rodata.

I agree that it should probably be rewritten to not use memcmp.


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.