qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] util: check the return value of fcntl in qem


From: Li Qiang
Subject: Re: [Qemu-devel] [PATCH v2] util: check the return value of fcntl in qemu_set_{block, nonblock}
Date: Fri, 14 Dec 2018 17:15:52 +0800

Li Qiang <address@hidden> 于2018年12月14日周五 上午9:46写道:

> Hi all,
>
> Here is the error.
>
>   GTESTER check-qtest-x86_64
> Unable to get file status flag on fd 21860: Bad file descriptor(errno=9)
>   GTESTER check-qtest-aarch64
> Broken pipe
> GTester: last random seed: R02S3f0d6981dd97231d06e0b2966baf94b9
> Unable to get file status flag on fd 21965: Bad file descriptor(errno=9)
> Broken pipe
> GTester: last random seed: R02S29fde958e7ee4c26c4f295ff4dbd47d4
> Unable to get file status flag on fd 21890: Bad file descriptor(errno=9)
> Broken pipe
> GTester: last random seed: R02S6d074187e5c8501255c96b247f5c8e3f
> Unable to get file status flag on fd 21923: Bad file descriptor(errno=9)
> Broken pipe
> GTester: last random seed: R02S446127f38eb9e8b4f181e6fc95026ba0
>   GTESTER tests/test-qht-par
> Could not access KVM kernel module: No such file or directory
>
>
> The fd '21860' '21965', '21890', '21923' is a little strange. Following is
> my guess.
>
> 21280 --> 0x5564
> 21965 --> 0x55CD
> 21890 --> 0x5582
> 21923 --> 0x55A3
>
> Seems they are stack uninitialized value which 'fd's memory holds.
> Seems 'qemu_chr_fe_get_msgfds' first failed, then the 'fd' is an
> uninitialized value
> cause my first patch 'assert' fails.
>
>

First of all I want to know does the following error means?
doesn't it mean "the x86 qtest is ok and aarch64 is not ok"?


  GTESTER check-qtest-x86_64
  GTESTER check-qtest-aarch64
vhost-user-test: /tmp/qemu-test/src/util/oslib-posix.c:245:
qemu_set_nonblock: Assertion `f != -1' failed.
Broken pipe
GTester: last random seed: R02S61a1e35369394d7efb0a0e96d8af615d
  GTESTER tests/test-qht-par
vhost-user-test: /tmp/qemu-test/src/util/oslib-posix.c:245:
qemu_set_nonblock: Assertion `f != -1' failed.
Broken pipe
GTester: last random seed: R02Sbf8c21ef5f216840e073ff3e487dedbc
vhost-user-test: /tmp/qemu-test/src/util/oslib-posix.c:245:
qemu_set_nonblock: Assertion `f != -1' failed.
Broken pipe
GTester: last random seed: R02Sfe8cd276fddf3a92891cf274bf88e888
vhost-user-test: /tmp/qemu-test/src/util/oslib-posix.c:245:
qemu_set_nonblock: Assertion `f != -1' failed.
Broken pipe
GTester: last random seed: R02S7487fc065e22541ba4c78c0db6c61d3c
Could not access KVM kernel module: No such file or directory


This issue is caused by 'chr_read' in vhost-user-test.c processes
'VHOST_USER_SET_VRING_CALL'.
qemu_chr_fe_get_msgfds->tcp_get_msgfds

static int tcp_get_msgfds(Chardev *chr, int *fds, int num)
{
    SocketChardev *s = SOCKET_CHARDEV(chr);

    int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num;

    assert(num <= TCP_MAX_FDS);

    if (to_copy) {
        int i;

        memcpy(fds, s->read_msgfds, to_copy * sizeof(int));

        /* Close unused fds */
        for (i = to_copy; i < s->read_msgfds_num; i++) {
            close(s->read_msgfds[i]);
        }

        g_free(s->read_msgfds);
        s->read_msgfds = 0;
        s->read_msgfds_num = 0;
    }

    return to_copy;
}

The 's->read_msgfds_num' is 0, so qemu_chr_fe_get_msgfds returns 0, and
'fd' be an uninitialized stack value.

The reason why 's->read_msgfds_num' is 0 is that in 'vhost_set_vring_file'.
the 'ioeventfd_enabled()' returns 0 and 'kvm_eventfds_allowed' is 0 which
means the
kernel doesn't support eventfd.

static int vhost_set_vring_file(struct vhost_dev *dev,
                                VhostUserRequest request,
                                struct vhost_vring_file *file)
{

    if (ioeventfd_enabled() && file->fd > 0) {
        fds[fd_num++] = file->fd;
    } else {
        msg.payload.u64 |= VHOST_USER_VRING_NOFD_MASK;
    }
  ...
    return 0;
}



After I look at the kernel, the arm platform seems doesn't support eventfd.

So if my understanding is correct in the first, '"the x86 qtest is ok and
aarch64 is not ok".
This can be explainable. But if not, there maybe another issue.

Since this is related with vhost-user-test, Cc Jason and Michael .

Thanks,
Li Qiang



> Thanks,
> Li Qiang
>
>
>
> <address@hidden> 于2018年12月14日周五 上午12:01写道:
>
>> Patchew URL:
>> https://patchew.org/QEMU/address@hidden/
>>
>>
>>
>> Hi,
>>
>> This series failed the address@hidden build test. Please find the
>> testing commands and
>> their output below. If you have Docker installed, you can probably
>> reproduce it
>> locally.
>>
>> === TEST SCRIPT BEGIN ===
>> #!/bin/bash
>> time make address@hidden SHOW_ENV=1 J=8
>> === TEST SCRIPT END ===
>>
>> libpmem support   no
>> libudev           no
>>
>> WARNING: Use of SDL 1.2 is deprecated and will be removed in
>> WARNING: future releases. Please switch to using SDL 2.0
>>
>> NOTE: cross-compilers enabled:  'cc'
>>   GEN     x86_64-softmmu/config-devices.mak.tmp
>>
>>
>> The full log is available at
>>
>> http://patchew.org/logs/address@hidden/address@hidden/?type=message
>> .
>> ---
>> Email generated automatically by Patchew [http://patchew.org/].
>> Please send your feedback to address@hidden
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]