Re: [PATCH i-g-t 1/2] igt/gem_fd_exhaustion: Actually test error handling on fd exhaustion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Karol Krol (2018-02-27 14:30:43)
> Long time ago, there was an issue with driver crashing due to lack of
> error handling on struct file creation (gem_create()). We're unable to hit
> this scenario, because dup() does not creat flip. Let's replace dup() with
> open() and assert that error is returned on exhaustion.
> 
> Signed-off-by: Karol Krol <karol.krol@xxxxxxxxx>
> ---
>  tests/gem_fd_exhaustion.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/gem_fd_exhaustion.c b/tests/gem_fd_exhaustion.c
> index 0969f9c6..6750444e 100644
> --- a/tests/gem_fd_exhaustion.c
> +++ b/tests/gem_fd_exhaustion.c
> @@ -65,7 +65,7 @@ igt_simple_main
>                 igt_drop_root();
>  
>                 for (int i = 0; ; i++) {
> -                       int leak = dup(fd);
> +                       int leak = open("/dev/null", O_RDONLY);
>                         uint32_t handle;
>  
>                         if (__gem_create(fd, 4096, &handle) == 0)
> @@ -73,6 +73,8 @@ igt_simple_main
>  
>                         if (leak < 0) {
>                                 igt_info("fd exhaustion after %i rounds.\n", i);
> +                               igt_assert(__gem_create(fd, 4096,
> +                                                       &handle) == -ENFILE);

No. It can fail for a variety of reasons (ENOMEM is an easy one), so you
cannot mandate it always fails with ENFILE.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux