This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 00/10] nptl: Fix Race conditions in pthread cancellation (BZ#12683)



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]