[openssl-dev] [openssl.org #4443] Re: VIA C7-D processor: Hang in 30-test_afalg.t

noloader@gmail.com via RT rt at openssl.org
Fri Mar 18 00:25:00 UTC 2016


> I think the [mostly] portable way to turn a pointer into an integral
> is a uintptr_t or size_t. I'm not sure about uintptr_t availability
> because of std=c89/90. size_t will work for most platforms; but the
> one I am aware it will fail is older hardware like i386/i486 with
> 16-bit segments and 32-bit registers.

Yeah, this looks fishy... According to the libc manual, 13.10 Perform
I/O Operations in Parallel
(https://www.gnu.org/software/libc/manual/html_node/Asynchronous-I_002fO.html):

    volatile void *aio_buf

        This is a pointer to the buffer with the data to
        be written or the place where the read data is
        stored.

That cast should be to a void*, not an unsigned long.

Jeff

On Thu, Mar 17, 2016 at 7:47 PM, Jeffrey Walton <noloader at gmail.com> wrote:
> I was looking at the code for afalg_fin_cipher_aio in engines/afalg/e_afalg.c:
>
> int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
>                          size_t len)
> {
>     int r;
>     int retry = 0;
>     unsigned int done = 0;
>     struct iocb *cb;
>     struct timespec timeout;
>     struct io_event events[MAX_INFLIGHTS];
>     u_int64_t eval = 0;
>
>     timeout.tv_sec = 0;
>     timeout.tv_nsec = 0;
>
>     cb = &(aio->cbt[0 % MAX_INFLIGHTS]);
>     memset(cb, '\0', sizeof(*cb));
>     cb->aio_fildes = sfd;
>     cb->aio_lio_opcode = IOCB_CMD_PREAD;
>     cb->aio_buf = (unsigned long)buf;
>     cb->aio_offset = 0;
>     cb->aio_data = 0;
>     cb->aio_nbytes = len;
>     cb->aio_flags = IOCB_FLAG_RESFD;
>     cb->aio_resfd = aio->efd;
>
>     ...
>
> That cast of 'buf' from 'unsigned char*' to 'unsigned long' does not
> quite look right.
>
> I think the [mostly] portable way to turn a pointer into an integral
> is a uintptr_t or size_t. I'm not sure about uintptr_t availability
> because of std=c89/90. size_t will work for most platforms; but the
> one I am aware it will fail is older hardware like i386/i486 with
> 16-bit segments and 32-bit registers.
>
> Can anyone confirm that's supposed to be happening?
>
> On Thu, Mar 10, 2016 at 2:29 PM, Jeffrey Walton <noloader at gmail.com> wrote:
>> Working from Master:
>>
>> $ git reset --hard HEAD && git pull
>> HEAD is now at fb04434 In the recipe using "makedepend", make sure the
>> object file extension is there
>> Already up-to-date.
>>
>> $ ./config
>> ...
>> $ make depend && make clean && make
>> ...
>> $ make test
>> ...
>> ( cd test; \
>>   SRCTOP=../. \
>>   BLDTOP=../. \
>>   EXE_EXT= \
>>     /usr/bin/perl .././test/run_tests.pl  )
>> ../test/recipes/01-test_ordinals.t ........ ok
>> ../test/recipes/05-test_bf.t .............. ok
>> ...
>> ../test/recipes/25-test_x509.t ............ ok
>> ../test/recipes/30-test_afalg.t ...........
>> ^C (after about 20 minutes)
>> ...


-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4443
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list