[PATCH v2] tests/syslog: GSOC Microproject: Modify test to pass imposed LSM configs

Bharath Vedartham linux.bhar at gmail.com
Sat Mar 2 15:30:36 UTC 2019


The current syslog test covers only cases where the type parameter is SYSLOG_ACTION_READ, SYSLOG_ACTION_READ_ALL, SYSLOG_ACTION_READ_CLEAR as per codecov.

Add test case to cover rest of the default cases.

PS: I am looking to apply for Gsoc. This is my first patch to strace.

---
Changes in v2:
    - Used SYSLOG_ACTION_CLEAR which is a privileged instruction. This will fail before the LSM hooks.
---
 tests/syslog.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/syslog.c b/tests/syslog.c
index fb933e7..b3b4154 100644
--- a/tests/syslog.c
+++ b/tests/syslog.c
@@ -14,7 +14,7 @@
 # include <unistd.h>
 
 # define SYSLOG_ACTION_READ 2
-# define SYSLOG_ACTION_SIZE_BUFFER 10
+# define SYSLOG_ACTION_CLEAR 5
 
 int
 main(void)
@@ -25,9 +25,9 @@ main(void)
 	printf("syslog(SYSLOG_ACTION_READ, %#lx, -1) = %d %s (%m)\n",
 	       addr, rc, errno2name());
 
-	rc = syscall(__NR_syslog, SYSLOG_ACTION_SIZE_BUFFER, addr, 10);
-	printf("syslog(SYSLOG_ACTION_SIZE_BUFFER, %#lx, 10) = %d\n",
-			        addr, rc);
+	rc = syscall(__NR_syslog, SYSLOG_ACTION_CLEAR, addr, 0);
+        printf("syslog(SYSLOG_ACTION_CLEAR, %#lx, 0) = %d %s (%m)\n",
+	       addr, rc, errno2name());
 
 	puts("+++ exited with 0 +++");
 	return 0;
-- 
2.7.4



More information about the Strace-devel mailing list