dtprobed: handle a crashed parser child better
PATCH 1/2 dtprobed: handle a crashed parser child better
When a parser child crashes and is restarted, its file handles might change: we should pick up the new fhes if so.
--- dtprobed/dtprobed.c | 6 ++++++ 1 file changed, 6 insertions(+)
dtprobed/dtprobed.c +6 -0
@@ -769,7 +769,13 @@ process_dof(pid_t pid, int out, int in, dev_t dev, ino_t inum, dev_t exec_dev,if (!provider) {if (tries++ >1 ) goto err; +/* +* Tidying reopens the parser in and out pipes: catch +* up with this. +*/ dof_parser_tidy (1 ); + out = parser_out_pipe; + in = parser_in_pipe;continue ; }if (provider->type !=DIT_PROVIDER && provider->type !=DIT_EOF )
Signature · 1 line
2.47.1.279.g84c5f4e78e
PATCH 2/2 libcommon: turn off FORTIFY_SOURCE more aggressively
This is incompatible with dof_parser_t's use of trailing strings of variable length, and buys us nothing anyway since we're running in a seccomped parser child and any buffer overruns are harmless and cannot result in anything other than a dying child. We were already -U'ing FORTIFY_SOURCE in libcommon_CPPFLAGS, but that precedes CFLAGS on the command line, so if the build system passes -D_FORTIFY_SOURCE there, it still takes effect.
Use _NOCFLAGS and _NOCPPFLAGS to explicitly disable every level of fortification that currently exists.
--- libcommon/Build | 2 ++ 1 file changed, 2 insertions(+)
libcommon/Build +2 -0
@@ -10,4 +10,6 @@ libcommon_TARGET = libcommon libcommon_DIR := $(current-dir) libcommon_CPPFLAGS := -Ilibcommon -Ilibproc -U_FORTIFY_SOURCE libcommon_SOURCES = dof_parser.c dof_parser_host.c dt_list.c +libcommon_NOCFLAGS := -D_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=3 +libcommon_NOCPPFLAGS := -D_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=3 libcommon_LIBSOURCES = libcommon
Signature · 1 line
2.47.1.279.g84c5f4e78e
Re: [PATCH 2/2] libcommon: turn off FORTIFY_SOURCE more aggressively
Quoted 8 lines · Nick Alcock
This is incompatible with dof_parser_t's use of trailing strings of variable length, and buys us nothing anyway since we're running in a seccomped parser child and any buffer overruns are harmless and cannot result in anything other than a dying child. We were already -U'ing
FORTIFY_SOURCEinlibcommon_CPPFLAGS, but that precedes CFLAGS on the command line, so if the build system passes -D_FORTIFY_SOURCE there, it still takes effect.
Quoted 4 lines
Use
_NOCFLAGSand_NOCPPFLAGSto explicitly disable every level of fortification that currently exists.Signed-off-by Nick Alcock <[email protected]>
Quoted 18 lines
--- libcommon/Build | 2 ++ 1 file changed, 2 insertions(+)libcommon/Build +2
-0@@ -10,4 +10,6 @@ libcommon_TARGET = libcommon libcommon_DIR := $(current-dir) libcommon_CPPFLAGS := -Ilibcommon -Ilibproc -U_FORTIFY_SOURCE libcommon_SOURCES = dof_parser.c dof_parser_host.c dt_list.c +libcommon_NOCFLAGS := -D_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=3 +libcommon_NOCPPFLAGS := -D_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=3 libcommon_LIBSOURCES = libcommonSignature · 1 line
2.47.1.279.g84c5f4e78e
Quoted 4 lines · Nick Alcock via DTrace-devel
When a parser child crashes and is restarted, its file handles might change: we should pick up the new fhes if so.
Signed-off-by Nick Alcock <[email protected]>
Quoted 30 lines
--- dtprobed/dtprobed.c | 6 ++++++ 1 file changed, 6 insertions(+)dtprobed/dtprobed.c +6
-0@@ -769,7 +769,13 @@ process_dof(pid_t pid, int out, int in, dev_t dev, ino_t inum, dev_t exec_dev,if (!provider) {if (tries++ >1 ) goto err; +/* +* Tidying reopens the parser in and out pipes: catch +* up with this. +*/ dof_parser_tidy (1 ); + out = parser_out_pipe; + in = parser_in_pipe;continue ; }if (provider->type !=DIT_PROVIDER && provider->type !=DIT_EOF )Signature · 7 lines
2.47.1.279.g84c5f4e78e _______________________________________________ DTrace-devel mailing list [email protected] https://oss.oracle.com/mailman/listinfo/dtrace-devel