From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932945AbdC1Xs6 (ORCPT ); Tue, 28 Mar 2017 19:48:58 -0400 Received: from smtp-sh.infomaniak.ch ([128.65.195.4]:44431 "EHLO smtp-sh.infomaniak.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932242AbdC1Xsz (ORCPT ); Tue, 28 Mar 2017 19:48:55 -0400 From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Alexei Starovoitov , Andy Lutomirski , Arnaldo Carvalho de Melo , Casey Schaufler , Daniel Borkmann , David Drysdale , "David S . Miller" , "Eric W . Biederman" , James Morris , Jann Horn , Jonathan Corbet , Matthew Garrett , Michael Kerrisk , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Shuah Khan , Tejun Heo , Thomas Graf , Will Drewry , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v6 09/11] seccomp: Enhance test_harness with an assert step mechanism Date: Wed, 29 Mar 2017 01:46:48 +0200 Message-Id: <20170328234650.19695-10-mic@digikod.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170328234650.19695-1-mic@digikod.net> References: <20170328234650.19695-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Antivirus: Dr.Web (R) for Unix mail servers drweb plugin ver.6.0.2.8 X-Antivirus-Code: 0x100000 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is useful to return an information about the error without being able to write to TH_LOG_STREAM. Helpers from test_harness.h may be useful outside of the seccomp directory. Signed-off-by: Mickaël Salaün Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Kees Cook Cc: Shuah Khan Cc: Will Drewry --- tools/testing/selftests/seccomp/test_harness.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/test_harness.h b/tools/testing/selftests/seccomp/test_harness.h index a786c69c7584..77e407663e06 100644 --- a/tools/testing/selftests/seccomp/test_harness.h +++ b/tools/testing/selftests/seccomp/test_harness.h @@ -397,7 +397,7 @@ struct __test_metadata { const char *name; void (*fn)(struct __test_metadata *); int termsig; - int passed; + __s8 passed; int trigger; /* extra handler after the evaluation */ struct __test_metadata *prev, *next; }; @@ -476,6 +476,12 @@ void __run_test(struct __test_metadata *t) "instead of by signal (code: %d)\n", t->name, WEXITSTATUS(status)); + } else if (t->passed < 0) { + fprintf(TH_LOG_STREAM, + "%s: Failed at step #%d\n", + t->name, + t->passed * -1); + t->passed = 0; } } else if (WIFSIGNALED(status)) { t->passed = 0; -- 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= Subject: [PATCH net-next v6 09/11] seccomp: Enhance test_harness with an assert step mechanism Date: Wed, 29 Mar 2017 01:46:48 +0200 Message-ID: <20170328234650.19695-10-mic@digikod.net> References: <20170328234650.19695-1-mic@digikod.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Alexei Starovoitov , Andy Lutomirski , Arnaldo Carvalho de Melo , Casey Schaufler , Daniel Borkmann , David Drysdale , "David S . Miller" , "Eric W . Biederman" , James Morris , Jann Horn , Jonathan Corbet , Matthew Garrett , Michael Kerrisk , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Shuah Khan , Tejun Heo In-Reply-To: <20170328234650.19695-1-mic@digikod.net> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org This is useful to return an information about the error without being able to write to TH_LOG_STREAM. Helpers from test_harness.h may be useful outside of the seccomp directory. Signed-off-by: Mickaël Salaün Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Kees Cook Cc: Shuah Khan Cc: Will Drewry --- tools/testing/selftests/seccomp/test_harness.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/test_harness.h b/tools/testing/selftests/seccomp/test_harness.h index a786c69c7584..77e407663e06 100644 --- a/tools/testing/selftests/seccomp/test_harness.h +++ b/tools/testing/selftests/seccomp/test_harness.h @@ -397,7 +397,7 @@ struct __test_metadata { const char *name; void (*fn)(struct __test_metadata *); int termsig; - int passed; + __s8 passed; int trigger; /* extra handler after the evaluation */ struct __test_metadata *prev, *next; }; @@ -476,6 +476,12 @@ void __run_test(struct __test_metadata *t) "instead of by signal (code: %d)\n", t->name, WEXITSTATUS(status)); + } else if (t->passed < 0) { + fprintf(TH_LOG_STREAM, + "%s: Failed at step #%d\n", + t->name, + t->passed * -1); + t->passed = 0; } } else if (WIFSIGNALED(status)) { t->passed = 0; -- 2.11.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: mic@digikod.net (=?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?=) Date: Wed, 29 Mar 2017 01:46:48 +0200 Subject: [PATCH net-next v6 09/11] seccomp: Enhance test_harness with an assert step mechanism In-Reply-To: <20170328234650.19695-1-mic@digikod.net> References: <20170328234650.19695-1-mic@digikod.net> Message-ID: <20170328234650.19695-10-mic@digikod.net> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org This is useful to return an information about the error without being able to write to TH_LOG_STREAM. Helpers from test_harness.h may be useful outside of the seccomp directory. Signed-off-by: Micka?l Sala?n Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Kees Cook Cc: Shuah Khan Cc: Will Drewry --- tools/testing/selftests/seccomp/test_harness.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/test_harness.h b/tools/testing/selftests/seccomp/test_harness.h index a786c69c7584..77e407663e06 100644 --- a/tools/testing/selftests/seccomp/test_harness.h +++ b/tools/testing/selftests/seccomp/test_harness.h @@ -397,7 +397,7 @@ struct __test_metadata { const char *name; void (*fn)(struct __test_metadata *); int termsig; - int passed; + __s8 passed; int trigger; /* extra handler after the evaluation */ struct __test_metadata *prev, *next; }; @@ -476,6 +476,12 @@ void __run_test(struct __test_metadata *t) "instead of by signal (code: %d)\n", t->name, WEXITSTATUS(status)); + } else if (t->passed < 0) { + fprintf(TH_LOG_STREAM, + "%s: Failed@step #%d\n", + t->name, + t->passed * -1); + t->passed = 0; } } else if (WIFSIGNALED(status)) { t->passed = 0; -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= Date: Wed, 29 Mar 2017 01:46:48 +0200 Message-Id: <20170328234650.19695-10-mic@digikod.net> In-Reply-To: <20170328234650.19695-1-mic@digikod.net> References: <20170328234650.19695-1-mic@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [kernel-hardening] [PATCH net-next v6 09/11] seccomp: Enhance test_harness with an assert step mechanism To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Alexei Starovoitov , Andy Lutomirski , Arnaldo Carvalho de Melo , Casey Schaufler , Daniel Borkmann , David Drysdale , "David S . Miller" , "Eric W . Biederman" , James Morris , Jann Horn , Jonathan Corbet , Matthew Garrett , Michael Kerrisk , Kees Cook , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Shuah Khan , Tejun Heo , Thomas Graf , Will Drewry , kernel-hardening@lists.openwall.com, linux-api@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org List-ID: This is useful to return an information about the error without being able to write to TH_LOG_STREAM. Helpers from test_harness.h may be useful outside of the seccomp directory. Signed-off-by: Mickaël Salaün Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Kees Cook Cc: Shuah Khan Cc: Will Drewry --- tools/testing/selftests/seccomp/test_harness.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/test_harness.h b/tools/testing/selftests/seccomp/test_harness.h index a786c69c7584..77e407663e06 100644 --- a/tools/testing/selftests/seccomp/test_harness.h +++ b/tools/testing/selftests/seccomp/test_harness.h @@ -397,7 +397,7 @@ struct __test_metadata { const char *name; void (*fn)(struct __test_metadata *); int termsig; - int passed; + __s8 passed; int trigger; /* extra handler after the evaluation */ struct __test_metadata *prev, *next; }; @@ -476,6 +476,12 @@ void __run_test(struct __test_metadata *t) "instead of by signal (code: %d)\n", t->name, WEXITSTATUS(status)); + } else if (t->passed < 0) { + fprintf(TH_LOG_STREAM, + "%s: Failed at step #%d\n", + t->name, + t->passed * -1); + t->passed = 0; } } else if (WIFSIGNALED(status)) { t->passed = 0; -- 2.11.0