FreeBSD Bugzilla – Attachment 235364 Details for
Bug 265087
Changes to pipe/socket handling causes configure test program to loop endless
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
265087.diff (text/plain), 2.37 KB, created by
Gleb Smirnoff
on 2022-07-19 17:14:08 UTC
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Gleb Smirnoff
Created:
2022-07-19 17:14:08 UTC
Size:
2.37 KB
patch
obsolete
>commit 0be1fa5ef6cdf067d9a6fa3b21b53dee47ef57a1 >Author: Gleb Smirnoff <glebius@FreeBSD.org> >Date: Tue Jul 19 10:07:53 2022 -0700 > > write(2): move all special error handling for sockets into soo_write() > > Sockets already have special handling for EPIPE, and after 65572cade35 > they also require special handling for transient errors, see d2b3a0ed31e. > > Thus, in dofilewrite() disable the whole block that handles errors for > DTYPE_SOCKET. In soo_write() add handling for transient errors. > > Fixes: 65572cade35 > PR: 265087 > Reported by: rz-rpi03 at h-ka.de > Reviewed by: markj > >diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c >index b8cf1ff4561..4553c3317c4 100644 >--- a/sys/kern/sys_generic.c >+++ b/sys/kern/sys_generic.c >@@ -562,12 +562,13 @@ dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio, > ktruio = cloneuio(auio); > #endif > cnt = auio->uio_resid; >- if ((error = fo_write(fp, auio, td->td_ucred, flags, td))) { >+ if ((error = fo_write(fp, auio, td->td_ucred, flags, td)) && >+ /* Socket layer is responsible for special error handling. */ >+ fp->f_type != DTYPE_SOCKET) { > if (auio->uio_resid != cnt && (error == ERESTART || > error == EINTR || error == EWOULDBLOCK)) > error = 0; >- /* Socket layer is responsible for issuing SIGPIPE. */ >- if (fp->f_type != DTYPE_SOCKET && error == EPIPE) { >+ if (error == EPIPE) { > PROC_LOCK(td->td_proc); > tdsignal(td, SIGPIPE); > PROC_UNLOCK(td->td_proc); >diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c >index 7f39e58f4ce..8aeee9958a8 100644 >--- a/sys/kern/sys_socket.c >+++ b/sys/kern/sys_socket.c >@@ -138,6 +138,7 @@ soo_write(struct file *fp, struct uio *uio, struct ucred *active_cred, > int flags, struct thread *td) > { > struct socket *so = fp->f_data; >+ ssize_t len; > int error; > > #ifdef MAC >@@ -145,7 +146,12 @@ soo_write(struct file *fp, struct uio *uio, struct ucred *active_cred, > if (error) > return (error); > #endif >+ len = uio->uio_resid; > error = sosend(so, 0, uio, 0, 0, 0, uio->uio_td); >+ if (uio->uio_resid != len && >+ (so->so_proto->pr_flags & PR_ATOMIC) == 0 && >+ (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) >+ error = 0; > if (error == EPIPE && (so->so_options & SO_NOSIGPIPE) == 0) { > PROC_LOCK(uio->uio_td->td_proc); > tdsignal(uio->uio_td, SIGPIPE);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 265087
:
235121
|
235123
| 235364