* [PATCH 6/6] dtprobed: fix dof_stash write failure handling
@ 2026-06-12 16:22 Kris Van Hees
0 siblings, 0 replies; 3+ messages in thread
From: Kris Van Hees @ 2026-06-12 16:22 UTC (permalink / raw)
To: dtrace, dtrace-devel
Use ssize_t for write() results, retry interrupted writes without treating
the negative length as progress, and unwind through the provider-close
path if writing parsed DOF fails. Replace the no-op assert(1) in the
corrupt-state path with abort().
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
dtprobed/dof_stash.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dtprobed/dof_stash.c b/dtprobed/dof_stash.c
index 6e62bdf6..144cc98d 100644
--- a/dtprobed/dof_stash.c
+++ b/dtprobed/dof_stash.c
@@ -420,10 +420,14 @@ write_chunk(int fd, const void *buf, size_t size)
char *bufptr = (char *) buf;
while (size > 0) {
- size_t len;
+ ssize_t len;
- if ((len = write(fd, bufptr, size)) < 0 && errno != EINTR)
- return -1;
+ if ((len = write(fd, bufptr, size)) < 0) {
+ if (errno != EINTR)
+ return -1;
+ else
+ continue;
+ }
size -= len;
bufptr += len;
@@ -796,7 +800,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
state = accump->parsed->type;
if (write_chunk(parsed_fd, accump->parsed, accump->parsed->size) < 0)
- goto err_probe_link;
+ goto err_provider_close;
break;
/* Error return from parser. */
@@ -817,7 +821,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
*/
fuse_log(FUSE_LOG_ERR, "dtprobed: PID %i, %lx/%lx: internal error: corrupt parsed DOF: type %i\n",
pid, dev, ino, accump->parsed->type);
- assert(1);
+ abort();
}
free(parsedfn);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6/6] dtprobed: fix dof_stash write failure handling
@ 2026-08-28 19:09 Kris Van Hees
2026-08-29 11:59 ` [DTrace-devel] " Alan Maguire
0 siblings, 1 reply; 3+ messages in thread
From: Kris Van Hees @ 2026-08-28 19:09 UTC (permalink / raw)
To: dtrace, dtrace-devel
Use ssize_t for write() results, retry interrupted writes without treating
the negative length as progress, and unwind through the provider-close
path if writing parsed DOF fails. Replace the no-op assert(1) in the
corrupt-state path with abort().
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
dtprobed/dof_stash.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dtprobed/dof_stash.c b/dtprobed/dof_stash.c
index 6e62bdf6..144cc98d 100644
--- a/dtprobed/dof_stash.c
+++ b/dtprobed/dof_stash.c
@@ -420,10 +420,14 @@ write_chunk(int fd, const void *buf, size_t size)
char *bufptr = (char *) buf;
while (size > 0) {
- size_t len;
+ ssize_t len;
- if ((len = write(fd, bufptr, size)) < 0 && errno != EINTR)
- return -1;
+ if ((len = write(fd, bufptr, size)) < 0) {
+ if (errno != EINTR)
+ return -1;
+ else
+ continue;
+ }
size -= len;
bufptr += len;
@@ -796,7 +800,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
state = accump->parsed->type;
if (write_chunk(parsed_fd, accump->parsed, accump->parsed->size) < 0)
- goto err_probe_link;
+ goto err_provider_close;
break;
/* Error return from parser. */
@@ -817,7 +821,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
*/
fuse_log(FUSE_LOG_ERR, "dtprobed: PID %i, %lx/%lx: internal error: corrupt parsed DOF: type %i\n",
pid, dev, ino, accump->parsed->type);
- assert(1);
+ abort();
}
free(parsedfn);
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [DTrace-devel] [PATCH 6/6] dtprobed: fix dof_stash write failure handling
2026-08-28 19:09 [PATCH 6/6] dtprobed: fix dof_stash write failure handling Kris Van Hees
@ 2026-08-29 11:59 ` Alan Maguire
0 siblings, 0 replies; 3+ messages in thread
From: Alan Maguire @ 2026-08-29 11:59 UTC (permalink / raw)
To: Kris Van Hees, dtrace, dtrace-devel
On 28/08/2026 20:09, Kris Van Hees via DTrace-devel wrote:
>
> Use ssize_t for write() results, retry interrupted writes without treating
> the negative length as progress, and unwind through the provider-close
> path if writing parsed DOF fails. Replace the no-op assert(1) in the
> corrupt-state path with abort().
>
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Took a while to make sense of that dof_stash_write_parsed(), but
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> ---
> dtprobed/dof_stash.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/dtprobed/dof_stash.c b/dtprobed/dof_stash.c
> index 6e62bdf6..144cc98d 100644
> --- a/dtprobed/dof_stash.c
> +++ b/dtprobed/dof_stash.c
> @@ -420,10 +420,14 @@ write_chunk(int fd, const void *buf, size_t size)
> char *bufptr = (char *) buf;
>
> while (size > 0) {
> - size_t len;
> + ssize_t len;
>
> - if ((len = write(fd, bufptr, size)) < 0 && errno != EINTR)
> - return -1;
> + if ((len = write(fd, bufptr, size)) < 0) {
> + if (errno != EINTR)
> + return -1;
> + else
> + continue;
> + }
>
> size -= len;
> bufptr += len;
> @@ -796,7 +800,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
> state = accump->parsed->type;
>
> if (write_chunk(parsed_fd, accump->parsed, accump->parsed->size) < 0)
> - goto err_probe_link;
> + goto err_provider_close;
> break;
>
> /* Error return from parser. */
> @@ -817,7 +821,7 @@ dof_stash_write_parsed(pid_t pid, dev_t dev, ino_t ino, dt_list_t *accum)
> */
> fuse_log(FUSE_LOG_ERR, "dtprobed: PID %i, %lx/%lx: internal error: corrupt parsed DOF: type %i\n",
> pid, dev, ino, accump->parsed->type);
> - assert(1);
> + abort();
> }
>
> free(parsedfn);
> --
> 2.52.0
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-29 12:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 19:09 [PATCH 6/6] dtprobed: fix dof_stash write failure handling Kris Van Hees
2026-08-29 11:59 ` [DTrace-devel] " Alan Maguire
-- strict thread matches above, loose matches on Subject: below --
2026-06-12 16:22 Kris Van Hees
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.