• Jiri Olsa's avatar
    perf tests: Add breakpoint modify tests · 9b3579fc
    Jiri Olsa authored
    Adding to tests that aims on kernel breakpoint modification bugs.
    
    First test creates HW breakpoint, tries to change it and checks it was
    properly changed. It aims on kernel issue that prevents HW breakpoint to
    be changed via ptrace interface.
    
    The first test forks, the child sets itself as ptrace tracee and waits
    in signal for parent to trace it, then it calls bp_1 and quits.
    
    The parent does following steps:
    
     - creates a new breakpoint (id 0) for bp_2 function
     - changes that breakpoint to bp_1 function
     - waits for the breakpoint to hit and checks
       it has proper rip of bp_1 function
    
    This test aims on an issue in kernel preventing to change disabled
    breakpoints
    
    Second test mimics the first one except for few steps
    in the parent:
     - creates a new breakpoint (id 0) for bp_1 function
     - changes that breakpoint to bogus (-1) address
     - waits for the breakpoint to hit and checks
       it has proper rip of bp_1 function
    
    This test aims on an issue in kernel disabling enabled
    breakpoint after unsuccesful change.
    
    Committer testing:
    
      # uname -a
      Linux jouet 4.18.0-rc8-00002-g1236568e #12 SMP Tue Aug 7 14:08:26 -03 2018 x86_64 x86_64 x86_64 GNU/Linux
      # perf test -v "bp modify"
      62: x86 bp modify                                         :
      --- start ---
      test child forked, pid 25671
      in bp_1
      tracee exited prematurely 2
      FAILED arch/x86/tests/bp-modify.c:209 modify test 1 failed
    
      test child finished with -1
      ---- end ----
      x86 bp modify: FAILED!
      #
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Milind Chabbi <chabbi.milind@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20180827091228.2878-2-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    9b3579fc
arch-tests.c 614 Bytes