test.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From: Lee Duncan <lduncan@suse.com>
  2. Date: Thu, 11 Feb 2021 11:34:42 -0800
  3. Subject: [PATCH] Fix test issue with gcc-11
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. Test 3.t exercises io_submit() with invalid addresses,
  8. and one test attempted to pass in "-1" as an invalid
  9. pointer. But gcc-11 realizes you cannot take an offset
  10. from an invalid pointer, making it impossible to
  11. compile or run this test:
  12. > sh# make CC=gcc-11 partcheck
  13. > make[1]: Entering directory '/alt/public_software/libaio/src'
  14. > make[1]: Nothing to be done for 'all'.
  15. > make[1]: Leaving directory '/alt/public_software/libaio/src'
  16. > make[1]: Entering directory '/alt/public_software/libaio/harness'
  17. > gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/2.t\" -o cases/2.p main.c ../src/libaio.a -lpthread
  18. > gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/3.t\" -o cases/3.p main.c ../src/libaio.a -lpthread
  19. > In file included from main.c:24:
  20. > cases/3.t: In function ‘test_main’:
  21. > cases/3.t:18:19: error: ‘attempt_io_submit’ accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]
  22. > 18 | status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT);
  23. > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. > cases/3.t:18:19: note: referencing argument 3 of type ‘struct iocb **’
  25. > In file included from cases/3.t:5,
  26. > from main.c:24:
  27. > cases/aio_setup.h:15:5: note: in a call to function ‘attempt_io_submit’
  28. > 15 | int attempt_io_submit(io_context_t ctx, long nr, struct iocb *ios[], int expect)
  29. > | ^~~~~~~~~~~~~~~~~
  30. > cc1: all warnings being treated as errors
  31. > make[1]: *** [Makefile:19: cases/3.p] Error 1
  32. > make[1]: Leaving directory '/alt/public_software/libaio/harness'
  33. > make: *** [Makefile:23: partcheck] Error 2
  34. The fix is to remove this one test case, since the compiler now
  35. ensures the running code will never see this case.
  36. Signed-off-by: Lee Duncan <leeman.duncan@gmail.com>
  37. ---
  38. harness/cases/3.t | 1 -
  39. 1 file changed, 1 deletion(-)
  40. diff -Nurp a/harness/cases/3.t b/harness/cases/3.t
  41. --- a/harness/cases/3.t 2018-10-22 20:59:34.000000000 +0100
  42. +++ b/harness/cases/3.t 2022-02-26 09:46:51.969845084 +0000
  43. @@ -15,7 +15,6 @@ int test_main(void)
  44. status |= attempt_io_submit(BAD_CTX, 1, good_ios, -EINVAL);
  45. status |= attempt_io_submit( io_ctx, 0, good_ios, 0);
  46. status |= attempt_io_submit( io_ctx, 1, NULL, -EFAULT);
  47. - status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT);
  48. status |= attempt_io_submit( io_ctx, 2, bad1_ios, -EFAULT);
  49. status |= attempt_io_submit( io_ctx, 2, bad2_ios, -EFAULT);
  50. status |= attempt_io_submit( io_ctx, -1, good_ios, -EINVAL);