]> granicus.if.org Git - strace/commitdiff
Disallow more than one signal= specification in an injection expression
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 28 Aug 2017 23:38:43 +0000 (23:38 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 28 Aug 2017 23:38:43 +0000 (23:38 +0000)
Specifying several signal= specifications in an injection expressions
makes no sense.

* filter_qualify.c (parse_inject_token): Disallow second
signal= specification.
* strace.1.in: Document it.
* tests/qual_inject-syntax.test: Check it.

filter_qualify.c
strace.1.in
tests/qual_inject-syntax.test

index f77ceed81dab7bcc38827225eb3d44fabf51f1fa..5b0ef28cb627f1c15266c577fc9a8b7b4b4f82b8 100644 (file)
@@ -140,6 +140,8 @@ parse_inject_token(const char *const token, struct inject_opts *const fopts,
                fopts->data.flags |= INJECT_F_RETVAL;
        } else if (!fault_tokens_only
                   && (val = STR_STRIP_PREFIX(token, "signal=")) != token) {
+               if (fopts->data.flags & INJECT_F_SIGNAL)
+                       return false;
                intval = sigstr_to_uint(val);
                if (intval < 1 || intval > NSIG_BYTES * 8)
                        return false;
index dc8300865e730a923b1cc0ccd10e1fecc8e483f7..61293cfa6d4dfc36e8f9d80c8438342bf720f63a 100644 (file)
@@ -654,8 +654,9 @@ An injection expression can contain only one
 .BR error =
 or
 .BR retval =
-specification.
-If an injection expression contains multiple
+specification, and only one
+.BR signal =
+specification.  If an injection expression contains multiple
 .BR when =
 specifications, the last one takes precedence.
 
index a9e44d748df0e379dd1e7507530f32d93be525d1..7aa618099a9bc9b6689116a65ebe64a418a4b250 100755 (executable)
@@ -103,6 +103,8 @@ for arg in '' , ,, ,,, : :: ::: \! \!, \!: \
           chdir:retval=-1 \
           chdir:signal=0 \
           chdir:signal=129 \
+          chdir:signal=1:signal=2 \
+          chdir:signal=1:retval=0:signal=2 \
           chdir:retval=0:retval=1 \
           chdir:error=1:error=2 \
           chdir:retval=0:error=1 \