lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Nov 2017 18:01:47 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Takashi Iwai <tiwai@...e.de>
Cc:     Baolin Wang <baolin.wang@...aro.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Fabian Frederick <fabf@...net.be>,
        Arvind Yadav <arvind.yadav.cs@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        alsa-devel@...a-project.org, Vinod Koul <vinod.koul@...el.com>,
        hardik.t.shah@...el.com, guneshwor.o.singh@...el.com,
        Liam Girdwood <lgirdwood@...il.com>,
        SF Markus Elfring <elfring@...rs.sourceforge.net>,
        gudishax.kranthikumar@...el.com, Mark Brown <broonie@...nel.org>,
        Bhumika Goyal <bhumirks@...il.com>,
        Naveen M <naveen.m@...el.com>, jeeja.kp@...el.com,
        Takashi Sakamoto <o-takashi@...amocchi.jp>,
        subhransu.s.prusty@...el.com, Ingo Molnar <mingo@...nel.org>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [alsa-devel] [RFC PATCH v2 7/7] sound: core: Avoid using timespec
 for struct snd_timer_tread

On Thu, Nov 9, 2017 at 5:52 PM, Takashi Iwai <tiwai@...e.de> wrote:
> On Mon, 06 Nov 2017 17:33:26 +0100,

>> --- a/include/uapi/sound/asound.h
>> +++ b/include/uapi/sound/asound.h
>> @@ -306,10 +306,19 @@ typedef int __bitwise snd_pcm_state_t;
>>
>>  enum {
>>         SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
>> -       SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
>> +       SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
>>         SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
>> +       SNDRV_PCM_MMAP_OFFSET_STATUS64 = 0x82000000,
>>  };
>>
>> +#if __BITS_PER_LONG == 64
>> +#define SNDRV_PCM_MMAP_OFFSET_STATUS SNDRV_PCM_MMAP_OFFSET_STATUS_OLD
>> +#else
>> +#define SNDRV_PCM_MMAP_OFFSET_STATUS ((sizeof(time_t) >
>> sizeof(__kernel_long_t)) ? \
>> +                                       SNDRV_PCM_MMAP_OFFSET_STATUS64 : \
>> +                                       SNDRV_PCM_MMAP_OFFSET_STATUS_OLD)
>> +#endif
>> +
>>  union snd_pcm_sync_id {
>>         unsigned char id[16];
>>         unsigned short id16[8];
>>
>> Does that make sense?
>
> Yeah, that should work.
>
> But can we make the flip without the dynamic sizeof() comparison but
> some ifdef?  The above doesn't allow the usage with switch(), for
> example.
>
> IOW, is there any macro indicating the 64bit user time_t?

There is a macro defined by the C library, but so far we have not
started relying on it in kernel headers, because there is no guarantee
that this symbol is visible before sys/time.h has been included,
and there are some cases where it's possible to include a kernel
header before sys/time.h.

In case of sound/asound.h, that should be no problem since we rely
on having seen the definition on 'struct timeval' already today, and
that must come from sys/time.h. Then we just need to make sure that
all C libraries define the same macro.

Are you sure about the switch()/case problem? I thought that worked
in C99, the only problem would be using the macro outside of a
function, e.g. as initalizer for a variable

> In theory we can have the shadow mmap for the compat timespec, and
> convert it always when the status gets changed.  But I guess disabling
> the mmap should work simply as is, judging from the 64bit compat
> status.

Ok.

       Arnd

Powered by blists - more mailing lists