Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
the clone syscall can return with some error codes that are not documented in the man page. In particular:
ERESTARTSYS = 512 (To be restarted if SA_RESTART is set)
Most common type of signal-interrupted syscall exit code. The
system call will be restarted with the same arguments if
SA_RESTART is set; otherwise, it will fail with EINTR.
ERESTARTNOINTR = 513 (To be restarted)
Rare. For example, fork() returns this if interrupted.
SA_RESTART is ignored (assumed set): the restart is
unconditional.
ERESTARTNOHAND = 514 (To be restarted if no handler)
pause(), rt_sigsuspend() etc use this code. SA_RESTART is
ignored (assumed not set): syscall won't restart (will return
EINTR instead) even after signal with SA_RESTART set. However,
after SIG_IGN or SIG_DFL signal it will restart (thus the name
"restart only if has no handler").
ERESTART_RESTARTBLOCK = 516 (Interrupted by signal)
Syscalls like nanosleep(), poll() which can't be restarted with
their original arguments use this code. Kernel will execute
restart_syscall() instead, which changes arguments before
restarting syscall. SA_RESTART is ignored (assumed not set)
similarly to ERESTARTNOHAND. (Kernel can't honor SA_RESTART
since restart data is saved in "restart block" in task struct,
and if signal handler uses a syscall which in turn saves
another such restart block, old data is lost and restart
becomes impossible)
Version-Release number of selected component (if applicable):
This is true for all man pages right up until the latest version in Fedora.
Hello Ben,
are you sure that clone syscall can return these error codes?
Quoting include/linux/errno.h [1]:
These should never be seen by user programs. To return one of ERESTART*
codes, signal_pending() MUST be set. Note that ptrace can observe these
at syscall exit tracing, but they will never be left for the debugged user
process to see.
So if you are seeing these error codes in strace output, it doesn't mean that they can actually be seen from userspace application.
Regards,
Nikola
[1] https://github.com/torvalds/linux/blob/master/include/linux/errno.h
OK, since from these ERESTART* error codes clone syscall can return only ERESTARTNOINTR, I think something like this could be added to the man page:
ERESTARTNOINTR (since Linux 2.6.17)
System call was interrupted by a signal and will be restarted.
(This can be seen only during a trace.)
The same should be probably added to the fork(2) man page.
What do you think, Ben?
I just conferred with the customer and they have not seen any of the other error codes in practice and so we think that your suggested addition would be sufficient.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://rhn.redhat.com/errata/RHBA-2016-2485.html
Description of problem: the clone syscall can return with some error codes that are not documented in the man page. In particular: ERESTARTSYS = 512 (To be restarted if SA_RESTART is set) Most common type of signal-interrupted syscall exit code. The system call will be restarted with the same arguments if SA_RESTART is set; otherwise, it will fail with EINTR. ERESTARTNOINTR = 513 (To be restarted) Rare. For example, fork() returns this if interrupted. SA_RESTART is ignored (assumed set): the restart is unconditional. ERESTARTNOHAND = 514 (To be restarted if no handler) pause(), rt_sigsuspend() etc use this code. SA_RESTART is ignored (assumed not set): syscall won't restart (will return EINTR instead) even after signal with SA_RESTART set. However, after SIG_IGN or SIG_DFL signal it will restart (thus the name "restart only if has no handler"). ERESTART_RESTARTBLOCK = 516 (Interrupted by signal) Syscalls like nanosleep(), poll() which can't be restarted with their original arguments use this code. Kernel will execute restart_syscall() instead, which changes arguments before restarting syscall. SA_RESTART is ignored (assumed not set) similarly to ERESTARTNOHAND. (Kernel can't honor SA_RESTART since restart data is saved in "restart block" in task struct, and if signal handler uses a syscall which in turn saves another such restart block, old data is lost and restart becomes impossible) Version-Release number of selected component (if applicable): This is true for all man pages right up until the latest version in Fedora.