bug-hurd
[Top][All Lists]
Advanced

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

Re: PCI arbiter crash on last qemu image


From: Joan Lledó
Subject: Re: PCI arbiter crash on last qemu image
Date: Sun, 23 Aug 2020 12:47:05 +0200 (CEST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

Hi, I made my changes on the arbiter and works fine, you can check my
code at

http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/?h=jlledom-pciaccess-map

On the other hand, I found a couple of issues in your patch

In map_dev_mem():

+    memfd = open("/dev/mem", flags | O_CLOEXEC);
+    if (memfd == -1)
+       return errno;
+
+    *dest = mmap(NULL, mem_size, prot, MAP_SHARED, memfd, mem_offset);
+    if (*dest == MAP_FAILED) {
+       close(memfd);
+       *dest = NULL;
+       return errno;
+    }
+
+    return 0;

here close() is only called when the map fails, it should be called also
before returning 0, when the map success.

Also in map_dev_mem(), it seems to be some problem when mapping the rom.
I tried to read the rom with hexdump:

hexdump -Cn 16 /servers/bus/pci/0000/00/03/0/rom

When running this command, it sometimes returns all zeroes and other
times returns the correct values, I checked it with the debugger and
found that is the call to vm_map who not always sets *dest correctly.
You can checkout my branch and try yourself.

In pci_device_x86_read_rom() the memory is mapped and unmapped for each
read. I wonder if it's correct to unmap with munmap() something mapped
with vm_map()

El 22/8/20 a les 15:10, Damien Zammit ha escrit:
> Hi Joan,
> 
> I found another probe() call in hurd_pci.c that should not be there.
> (So I dropped a second incorrect patch).
> Can you please confirm this final branch looks correct?
> 
> http://git.zammit.org/libpciaccess.git/log/?h=rumpdisk-upstream
> 
> Thanks,
> Damien
> 



reply via email to

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