0025-harness-fix-read-into-PROT_WRITE-mmap-test.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From d7f5065448efb49b2a26e728ff735e12ea05b62e Mon Sep 17 00:00:00 2001
  2. From: Jeff Moyer <jmoyer@redhat.com>
  3. Date: Tue, 13 Aug 2019 15:30:05 -0400
  4. Subject: [PATCH libaio 25/28] harness: fix read into PROT_WRITE mmap test
  5. This test has been broken forever. Fix it up to perform an
  6. aio_read using the result of a regular read as the expected
  7. return code.
  8. Reported-by: Guillem Jover <guillem@hadrons.org>
  9. Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
  10. ---
  11. harness/cases/5.t | 6 +++---
  12. 1 file changed, 3 insertions(+), 3 deletions(-)
  13. diff --git a/harness/cases/5.t b/harness/cases/5.t
  14. index 2b4b4bb..7d67562 100644
  15. --- a/harness/cases/5.t
  16. +++ b/harness/cases/5.t
  17. @@ -40,14 +40,14 @@ int test_main(void)
  18. buf = mmap(0, page_size, PROT_WRITE, MAP_SHARED, rwfd, 0);
  19. assert(buf != (char *)-1);
  20. - status |= attempt_rw(rwfd, buf, SIZE, 0, READ, SIZE);
  21. -
  22. /* Whether PROT_WRITE is readable is arch-dependent. So compare
  23. * against read result. */
  24. res = read(rwfd, buf, SIZE);
  25. if (res < 0)
  26. res = -errno;
  27. - status |= attempt_rw(rwfd, buf, SIZE, 0, WRITE, res);
  28. + status |= attempt_rw(rwfd, buf, SIZE, 0, READ, res);
  29. +
  30. + status |= attempt_rw(rwfd, buf, SIZE, 0, WRITE, SIZE);
  31. return status;
  32. }
  33. --
  34. 2.26.0.292.g33ef6b2f38