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  linux-cve-announce  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]
Message-ID: <4638359B.6050500@haxent.com.br>
Date:	Wed, 02 May 2007 03:54:19 -0300
From:	Davi Arnaut <davi@...ent.com.br>
To:	Eric Dumazet <dada1@...mosbay.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Davide Libenzi <davidel@...ilserver.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [patch 14/22] pollfs: pollable futex

Eric Dumazet wrote:
> Davi Arnaut a écrit :
>> Eric Dumazet wrote:
>>> Davi Arnaut a écrit :
>>>> Asynchronously wait for FUTEX_WAKE operation on a futex if it still contains
>>>> a given value. There can be only one futex wait per file descriptor. However,
>>>> it can be rearmed (possibly at a different address) anytime.
>>>>
>>>> The pollable futex approach is far superior (send and receive events from
>>>> userspace or kernel) to eventfd and fixes (supercedes) FUTEX_FD at the same time.
>>>>
>>>> Building block for pollable semaphores and user-defined events.
>>>>
>>>> Signed-off-by: Davi E. M. Arnaut <davi@...ent.com.br>
>>>>

<snip>

>>>> +
>>>> +struct futex_event {
>>>> +	union {
>>>> +		void __user *addr;
>>>> +		u64 padding;
>>>> +	};
>>>> +	int val;
>>>> +};
>>> Hum... Here we might have a problem with 64 bit futexes, or private futexes
>>>
>>> So I believe this interface is not well defined and not expandable: in case of 
>>> future additions to futexes, an old application compiled with an old pollable 
>>> futex_event type might fail.
>>>
>> Hmm, how about:
>>
>> struct futex_event {
>> 	union {
>> 		void __user *addr;
>> 		u64 padding;
>> 	};
>> 	union {
>> 		int val;
>> 		s64 val64;
>> 	};
>> 	/* whatever room is necessary for future improvements */
>> };
>>
>> I haven't been keeping up with 64 bit or private futexes. What else
>> could probably go wrong?
> 
> Well, that's the point : This interface is like an ioctl() one : pretty bad if 
> not properly designed :)

I was merely mirroring the futex syscall arguments for FUTEX_WAIT. Will
those change? I hope not :)

> You probably need to stick one field containing one command or version number, 
> something like that.

I'm a bit skeptical that we need versioning for such a simple operation
(command) as FUTEX_WAIT that takes an address and a value.

> 
> 
> struct futex_event {
> 	int     type;
> 	union {
> 		void __user *addr;
> 		u64 padding;
> 	};
> 	union {
> 		int val;
> 		s64 val64;
> 	};
> };
> 
> #define  FUTEX_EVENT_SHARED32  1
> #define  FUTEX_EVENT_SHARED64  2
> #define  FUTEX_EVENT_PRIVATE32 (128|1)
> #define  FUTEX_EVENT_PRIVATE64 (128|2)

I will take a look at the private futexes patches before commenting further.

> ...
> 
> Also, you should take care of alignements constraints (a 32bit user program 
> might run on a 64bit kernel)
> 

Compat code? or futex alignements constraints?

--
Davi Arnaut

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ