[PATCH] Linux: Fix '__close_nocancel_nostatus' clobbering 'errno' [BZ #33035]
Florian Weimer
fweimer@redhat.com
Fri May 30 15:44:15 GMT 2025
* Maciej W. Rozycki:
> Fix fallout from commit c181840c93d3 ("Consolidate non cancellable close
> call") that caused '__close_nocancel_nostatus' to clobber 'errno' on a
> close(2) failure, a 2.27 regression.
>
> The problem came from a rewrite from 'close_not_cancel_no_status' to
> '__close_nocancel_nostatus' switching from an inline implementation that
> used INTERNAL_SYSCALL macro (which stays away from 'errno') to a call to
> '__close_nocancel' function that uses INLINE_SYSCALL_CALL macro (which
> does poke at 'errno').
>
> Implement '__close_nocancel_nostatus' then as a standalone function in
> terms of INTERNAL_SYSCALL_CALL, which leaves 'errno' intact. This is a
> generic Linux version analogous to '__close_nocancel'. Platforms may
> choose to implement an inline variant where the syscall invocation code
> sequence is short enough to be beneficial over a function call.
I think you should just switch the implementation to
INTERNAL_SYSCALL_CALL, like we use today for __writev_nocancel_nostatus.
Thanks,
Florian
More information about the Libc-alpha
mailing list