This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 00/10] nptl: Fix Race conditions in pthread cancellation (BZ#12683)
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 18 Sep 2015 14:25:51 -0300
- Subject: Re: [PATCH 00/10] nptl: Fix Race conditions in pthread cancellation (BZ#12683)
- Authentication-results: sourceware.org; auth=none
- References: <55FB1CA0 dot 2 at linaro dot org> <alpine dot DEB dot 2 dot 10 dot 1509172032090 dot 2455 at digraph dot polyomino dot org dot uk> <55FC0CC7 dot 5030809 at linaro dot org> <alpine dot DEB dot 2 dot 10 dot 1509181322290 dot 5001 at digraph dot polyomino dot org dot uk> <55FC1F25 dot 402 at linaro dot org> <alpine dot DEB dot 2 dot 10 dot 1509181511300 dot 11870 at digraph dot polyomino dot org dot uk>
On 18-09-2015 12:31, Joseph Myers wrote:
> On Fri, 18 Sep 2015, Adhemerval Zanella wrote:
>
>> I see for such cases the port would need to provide extra implementation
>> for such symbols in the case (as the fstat for x32 does). I see this a
>> better approach, but I am open to suggestions.
>
> I'm not clear on what you're referring to as "fstat for x32" - I don't see
> an fstat implementation in sysdeps/unix/sysv/linux/x86_64/x32/ - but in
> any case, it's generally desirable to avoid the need for
> architecture-specific implementations of functions if we can do something
> generic instead. And fstat isn't a good example as its only non-error
> return is 0 (like most syscalls) so the return type doesn't matter.
My confusion here, I mean lseek.
>
>> And for lseek we need to define for GLIBC if this function is indeed a
>> cancellation entrypoint of not and make it consistent for all architectures
>> (and POSIX states it an optional one [1]).
>>
>> [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_05_02
>
> Yes, we need to make this consistent unless there is a good reason for the
> inconsistency.
>
> It seems lseek was made not-cancellable for some systems by
>
> 2003-07-14 Ulrich Drepper <drepper@redhat.com>
>
> More cancellation handling fixups.
> [...]
> * sysdeps/unix/sysv/linux/llseek.c: Must not be cancelable.
> * sysdeps/unix/syscalls.list: Don't mark lseek as cancelable.
>
> (see <https://sourceware.org/ml/libc-hacker/2003-07/msg00012.html>) but
> that didn't make the change for 64-bit architectures. (But it's marked
> with __THROW.)
>
>> One way is to make the return syscall another type like __syscall_arg_t
>> and make the specific implementation for such ports to redefine it to
>> a better one if it is required.
>
> I think that's the right logical thing to do to handle such ABIs more
> cleanly and reliably.
The only reasoning of making lseek non-cancellable is it might make function
which calls it also cancellable. But in this case we can create a non cancellable
version (like the open wrapper) and use it instead.
>
> Whether it's needed for this patch series could be determined by examining
> all syscalls.list entries for cancellable syscalls that can be used for
> ILP32 configurations with 64-bit registers used in the syscall interface
> (that's MIPS n32 and x86_64 x32, and I'm not sure about what the syscall
> interface for tilegx32 looks like), to see if any beyond lseek can return
> non-error values 2^32 or more.
>
Yes, this is my next step now.