I got the following failure:

ptrace03    0  WARN  :  ptrace() returned 0; errno: 0, Success
ptrace03    1  FAIL  :  Test Failed
ptrace03    2  PASS  :  Test Passed
ptrace03    3  PASS  :  Test Passed

This is because the latest kernel allows init process to be traced.

The commit is:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=00cd5c37afd5f431ac186dd131705048c0a11fdb

See the discussion in LKML:
http://marc.info/?t=120628018600001

So we should not execute this test case if the kernel version
is above 2.6.25.

Here is the test result after patching (linux 2.6.26-rc2):

ptrace03    1  CONF  :  this kernel allows to trace init
ptrace03    2  PASS  :  Test Passed
ptrace03    3  PASS  :  Test Passed

Signed-off-by: Li Zefan <[EMAIL PROTECTED]>
---
 ptrace03.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff -Nurp ltp-full-20080430.orig/testcases/kernel/syscalls/ptrace/ptrace03.c 
ltp-full-20080430/testcases/kernel/syscalls/ptrace/ptrace03.c
--- ltp-full-20080430.orig/testcases/kernel/syscalls/ptrace/ptrace03.c  
2008-05-08 09:55:54.000000000 +0800
+++ ltp-full-20080430/testcases/kernel/syscalls/ptrace/ptrace03.c       
2008-05-21 10:10:29.000000000 +0800
@@ -34,6 +34,8 @@
  *     Verifies that
  *     1) ptrace() returns -1 & sets errno to EPERM while tring to trace
  *        process 1
+ *         (This test case will be executed only if the kernel version
+ *          is 2.6.25 or below)
  *     2) ptrace() returns -1 & sets errno to ESRCH if process with
  *        specified pid does not exist
  *     3) ptrace() returns -1 & sets errno to EPERM if we are trying
@@ -137,6 +139,14 @@ main(int ac, char **av)
 
                for (i = 0; i < TST_TOTAL; ++i) {
 
+                       /* since Linux 2.6.26, it's allowed to trace init,
+                          so just skip this test case */
+                       if (i == 0 && tst_kvercmp(2,6,25) > 0) {
+                               tst_resm(TCONF,
+                                        "this kernel allows to trace init");
+                               continue;
+                       }
+
                        /* fork() */
                        switch (child_pid = FORK_OR_VFORK()) {
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to