[PATCH] tsan: support for linux aio

Dmitry Vyukov dvyukov at google.com
Wed Nov 27 02:06:42 PST 2013


On Wed, Nov 27, 2013 at 1:13 PM, Evgeniy Stepanov <eugenis at google.com> wrote:
>
>
> ================
> Comment at: sanitizer_common/sanitizer_common_syscalls.inc:1318
> @@ +1317,3 @@
> +      __sanitizer_iovec *iovec = (__sanitizer_iovec*)iocbpp[i]->aio_buf;
> +      for (uptr v = 0; v < len; v++)
> +        PRE_READ(iovec[i].iov_base, iovec[i].iov_len);
> ----------------
> Are you sure len (which is aio_nbytes) is the number of iovec entries, and not the size of the array in bytes?

aio_nbytes is not what you think it is:

struct iocb {
PADDEDptr(void *data, __pad1); /* Return in the io completion event */
PADDED(unsigned key, __pad2); /* For use in identifying io requests */

short aio_lio_opcode;
short aio_reqprio;
int aio_fildes;

union {
struct io_iocb_common c;
struct io_iocb_vector v;
struct io_iocb_poll poll;
struct io_iocb_sockaddr saddr;
} u;
};

It's difficult to understand what is where. But at least I saw sane
values in logs:

syscall_io_submit[0] op=8 fd=9 data=0x7d5400004d80
syscall_io_submit pwritev len=1
syscall_io_submit pwritev[0] 0x7da000016000/0x000000002000




> ================
> Comment at: sanitizer_common/sanitizer_platform_limits_linux.cc:73
> @@ -72,2 +72,3 @@
>
> -COMPILER_CHECK(struct_io_event_sz == sizeof(struct io_event));
> +COMPILER_CHECK(sizeof(__sanitizer_io_event) == sizeof(struct io_event));
> +CHECK_SIZE_AND_OFFSET(io_event, data);
> ----------------
> Use CHECK_TYPE_SIZE.


Done in r195832.

> ================
> Comment at: sanitizer_common/sanitizer_platform_limits_posix.h:120
> @@ -113,1 +119,3 @@
>    const unsigned iocb_cmd_pwrite = 1;
> +  const unsigned iocb_cmd_preadv = 7;
> +  const unsigned iocb_cmd_pwritev = 8;
> ----------------
> Add compile-time checks for these values.

Done in r195832.



More information about the llvm-commits mailing list