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 03/15] sparc: Use Linux kABI for syscall return



On 12/02/2020 09:38, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> This code seems to come from since initial git repository 
>> (Linux-2.6.12-rc2).
>>
>> From a glibc standpoint, the error handling will be the same in fact,
>> since what indicates the syscall has failed is the carry condition code
>> value, not the syscall returned value ('o0' register).
> 
> The kernel will not set the carry condition code for large errors due
> to the faulty check.  I think before your changes, we would not treat
> these cases as errors because the carry condition is not set and we
> check the separate err value.  After your changes, the carry condition
> code is still not set, but the return value looks like an error return
> value if unchanged, so we now treat these leaked error codes as
> errors.

No, the sparc 'ret_sys_call' returns abs(errno) for syscall failure,
not the value in the range of the expected Linux failure values.

So, if kernel returns a value large than ERESTART_RESTARTBLOCK *without*
set the carry condition code set current syscall code results in:

  o0 = abs (errno)
  g1 = 0

And then the variable defined by INTERNAL_SYSCALL_DECL holds '0' and 
INTERNAL_SYSCALL_ERROR_P evaluates to false.

With this change:

  o0 = abs (errno)

And INTERNAL_SYSCALL_ERROR_P, which now uses the expected Linux kABI,
will evaluate to 0 as well.

> 
> But I don't think this should block your changes.
> 


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