Groups | Search | Server Info | Login | Register


Groups > gnu.hurd.bug > #12064

Re: PCI arbiter crash on last qemu image

From Joan Lledó <jlledom@mailfence.com>
Newsgroups gnu.hurd.bug
Subject Re: PCI arbiter crash on last qemu image
Date 2020-08-23 12:47 +0200
Message-ID <mailman.849.1598179634.2469.bug-hurd@gnu.org> (permalink)
References (5 earlier) <728b60a0-d226-5d36-ba76-82f1f6ce3101@zamaudio.com> <fc77f621-d051-06ba-0d0a-839a269b89ee@mailfence.com> <2559279e-72a6-a87a-ad0d-cbe71102f69e@zamaudio.com> <7c5e596c-2f62-9843-8478-681c2e5e9fcc@zamaudio.com> <81a609ee-4a10-5e91-1872-8cb861087e90@mailfence.com>

Show all headers | View raw


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
> 

Back to gnu.hurd.bug | Previous | Next | Find similar


Thread

Re: PCI arbiter crash on last qemu image Joan Lledó <jlledom@mailfence.com> - 2020-08-23 12:47 +0200

csiph-web