[LTP] [PATCH] [RFC] brk01: Rewrite from scratch.
    Cyril Hrubis 
    chrubis@suse.cz
       
    Tue Dec 12 15:01:43 CET 2017
    
    
  
Hi!
> git format-patch has parameter "-B", that can make big rewrites
> more readable.
Will use it next time, thanks.
> diff --git a/testcases/kernel/syscalls/brk/brk01.c b/testcases/kernel/syscalls/brk/brk01.c
> index 2467ef6732a0..d77c000df105 100644
> --- a/testcases/kernel/syscalls/brk/brk01.c
> +++ b/testcases/kernel/syscalls/brk/brk01.c
> @@ -22,6 +22,7 @@
>  
>  #include "tst_test.h"
>  
> +void *ptr;
>  void verify_brk(void)
>  {
>         uintptr_t cur_brk, new_brk;
> @@ -65,6 +66,9 @@ void verify_brk(void)
>                 /* Try to write to the newly allocated heap */
>                 if (i % 3 == 0)
>                         *((char *)cur_brk) = 0;
> +               ptr = malloc(2*4096);
> +               printf("%p\n", ptr);
> +
>         }
>  
>         tst_res(TPASS, "brk() works fine");
> 
> $ ./brk01
> ...
> tst_test.c:1022: BROK: Test killed by SIGSEGV!
> 
> My concern is that glibc allocates something as result
> of tst_* calls (e.g. buffered I/O write) and then we
> either write over it or de-allocate it. I think we should
> drop/postpone first tst_res().
Sounds reasonably I'm okay with dropping the tst_res() in the middle of
the loop. I guess that doing any library calls between the brk() that
enlarges and shrinks the heap is dangerous indeed.
And we may also increse the heap size by a few pages before we start the
actual test just as a safety measure.
-- 
Cyril Hrubis
chrubis@suse.cz
    
    
More information about the ltp
mailing list