IRC channel logs

2024-04-01.log

back to list of logs

<almuhs>same error
<almuhs>/home/pruebas/rumpkernel-0~20211031+repack/pci-userspace/src-gnu/pci_user-gnu.c:551:15: error: implicit declaration of function 'vm_pages_phys' [-Werror=implicit-function-declaration]
<almuhs> 551 | ret = vm_pages_phys (master_host, tp, vaddr, PAGE_SIZE, &paddrp, &count);
<almuhs> | ^~~~~~~~~~~~~
<Pellescours>need to add a #include maybe?
<youpi>how did you run the build?
<almuhs>dpkg-buildpackage -B -uc -d
<youpi>Pellescours: the patch already adds #include "gnumach_U.h"
<youpi>almuhs: you probably want to check with find . -name gnumach_U.h that it did get generated
<youpi>and that it does contain the additional declaration
<youpi>(but again, you can as well just drop the patch, it's only an optimization...)
<almuhs>it's not a test error, it's a compilation error
<youpi>? I didn't say it was a test error
<almuhs>yesterday i removed the patch but the error appeared anyway
<youpi>had you de-applied the patch before removing it from the series?
<youpi>the presence of "vm_pages_phys" in the source can only mean that the patch was not de-applide
<almuhs>how can i de-apply the patch?
<youpi>(03:18:40) youpi: you can quilt pop the vm_pages_phys.diff patch
<youpi>man quilt
<youpi>see pop
<almuhs>oh, i only moved the file out of the directory
<youpi>at some point you need to get acquainted with finding such answers by yourself
<almuhs>i didn't undertood that "quilt pop" is
<youpi>that's what I mean: then look it up in the documentation
<youpi>you'll always get stuck in all kinds of situations if you don't get acquainted with the man reflex
<Pellescours>patching the source tree is part of the build process of a package in debian. You have the source, a series of patches and before compiling, patches are applied.
<almuhs>if i don't understand what is (even if this is a command, or an action...) i don't know what search
<youpi>the unknown words in my sentences were quilt and pop
<youpi>so man quit and man pop
<youpi>man pop doesn't produce any answer
<youpi>so man quilt
<youpi>and /pop
<youpi>and there you get it
<youpi>really, it's an important thing: we cannot spend all our time explaining what is already expained in manpages
<almuhs>there are not any page in man for quilt
<youpi>??
<youpi>of course there is
<youpi>dpkg -S quilt.1
<youpi>quilt: /usr/share/man/man1/quilt.1.gz
<youpi>it's in there
<almuhs>$ man quilt
<almuhs>Ninguna entrada del manual para quilt
<youpi>bad distro, change distro...
<youpi>or...
<youpi>do you have the quilt package installed ?
<almuhs>wait
<almuhs>i'm installing
<almuhs>installed. Reading man
<Pellescours>youpi: when a package is build, are the build logs kept somewhere? I want to see a build logs (of test) of python12 package
<youpi>Pellescours: not by default, no
<almuhs>notice that i never had create a deb before
<youpi>sure, no pb with that
<youpi>Pellescours: but there are archives of the package builds on buildd.debian.org
<almuhs>$ quilt pop vm_pages_phys.diff
<almuhs>Patch ../patches/vm_pages_phys.diff is not applied
<Pellescours>ok, because I’m compiling python3.12 (non debian image, from cross-hurd bootstraped VM) and I can see a test that fails (test_json). It’s not a blocker to build python but I want to know if debian also has this problem.
<youpi>almuhs: stay at the root
<youpi>otherwise quilt doesn't find .pc/
<youpi>(root of the build tree, where debian/ is)
<almuhs>pruebas@debian-hurd:~/rumpkernel-0~20211031+repack$ quilt pop vm_pages_phys.diff
<almuhs>No patch removed
<youpi>Pellescours: then you can indeed go to buildd.debian.org/python3.12
<youpi>you can use "quilt applied" to check what's actually applied
<youpi>also "ls .pc/" to make sure what's happening
<almuhs>pruebas@debian-hurd:~/rumpkernel-0~20211031+repack$ quilt applied
<almuhs>debian/patches/path_max.diff
<almuhs>debian/patches/ata-rump.diff
<almuhs>debian/patches/piixide-rump.diff
<almuhs>debian/patches/ahcisata-rump.diff
<youpi>and "quilt series" to make sure it is reading debian/patches/series
<almuhs>debian/patches/busspaceunmap-rump.diff
<almuhs>debian/patches/memory-range.diff
<almuhs>debian/patches/gnumach-update
<almuhs>debian/patches/rumpuser-rng-debug.diff
<almuhs>debian/patches/machirqdev.diff
<almuhs>debian/patches/dealloc.diff
<almuhs>debian/patches/netbsd-build.diff
<almuhs>debian/patches/no-virtio-rump.diff
<almuhs>debian/patches/pci-userspace-rump.diff
<almuhs>debian/patches/rumpuser-evcnt.diff
<almuhs>debian/patches/ps-comm.diff
<almuhs>debian/patches/idtype_t.diff
<almuhs>debian/patches/acpi.diff
<almuhs>debian/patches/linux
<almuhs>debian/patches/crossbuild
<almuhs>debian/patches/clean_libpci
<almuhs>debian/patches/random
<almuhs>debian/patches/non-fhs-shell
<almuhs>debian/patches/clean_external
<almuhs>debian/patches/PAE
<youpi>one thing: if you have removed vm_pages_phys.diff from debian/patches/series by hand, quilt will be confused
<almuhs>debian/patches/vm_allocate_contiguous_align
<almuhs>debian/patches/err
<almuhs>debian/patches/vm_pages_phys.diff
<almuhs>in this list appears as applied
<youpi>so you possibly need to re-introduce it there for quilt not to be confused
<youpi>ah, sorry, I understood
<youpi>quilt pop vm_pages_phys.diff doesn't mean what you want
<youpi>see manpage, it means to pop up to vm_pages_phys.diff, but not including
<Pellescours>And when I tried to compile python3.12 on my debian VM, it hanged.
<youpi>so just "quilt pop"
<almuhs>ok, now it makes sense
<almuhs>Removing patch debian/patches/vm_pages_phys.diff
<almuhs>pruebas@debian-hurd:~/rumpkernel-0~20211031+repack$ quilt pop
<almuhs>Removing patch debian/patches/vm_pages_phys.diff
<almuhs>Restoring pci-userspace/src-gnu/Makefile.inc
<almuhs>Restoring pci-userspace/src-gnu/pci_user-gnu.c
<almuhs>Now at patch debian/patches/err
<youpi>and then you can comment it from debian/patches/series
<youpi>so dpkg-buildpackage doesn't re-apply it
<almuhs>ok
<almuhs>do i need to move the file?
<youpi>no
<youpi>just comment the line in the series file
<almuhs>ok
<youpi>that'll be enough, and easy to revert if needed
<almuhs>compiling again
<youpi>note that you have learnt about quilt, that's a very useful thing
<youpi>while it's compiling, read the manpage, it's a very convenient tool
<almuhs>reading
<almuhs>ok, now there are not an compilation error in this. But there are compilation errors in my code :-[. Some type incompatibilty in prints
<almuhs>fixing
<youpi>"good news" then :)
<almuhs>fuck. The VM keeps freezed during the compilation
<youpi>how much ram do you have?
<youpi>you possibly need a lot
<youpi>I typically use 3G
<almuhs>I had 2G
<almuhs>I put 4G, but in 32-bit the VM don't reach that size
<youpi>sure, but 3G is better than 2G :)
<almuhs>free -h shows 2GiB in total
<almuhs>my gnumach is not PAE, i think
<youpi>don't put 4G, but 3G
<youpi>otherwise qemu puts 2G memory beyond 4G
<youpi>by asking for 3G, you have it all under 4G
<almuhs>ok
<almuhs>same. free -h show 2 GiB in total
<youpi>possibly that's because you use some disk controller that takes some adressing space below 4G
<youpi>do you have swap?
<almuhs>yes
<almuhs>974MiB
<youpi>does it get to fill before the VM freezes?
<youpi>are you using rumpdisk while building?
<almuhs>i didn't check it
<almuhs>yes, i'm using rumpdisk
<youpi>perhaps better not use it while building, since it hogs memory and the swapping might not be working with rumpdisk
<almuhs>i'm trying to change to IDE to use gnumach's IDE driver, but the disk is detected as SATA
<almuhs>modifing qemu script
<Pellescours>is it a problem to use 4G with PAE? I just tried and free see 4G
<youpi>rumpdisk is not completely ready for that
<youpi>and the gnumach drivers are not at all
<youpi>possibly the linux glue and rumpdisk glue do the pingpong
<Pellescours>Ah I see so it works now because It use less that 1GiB, but if I stress it a bit I can have issues okay
<youpi>possibly
<youpi>though normally the allocator allocates highest whenever possible
<youpi>so in principle you already hit the worstcase
<Pellescours>I didn’t do anything except boot and run `free`
<youpi>still, that loads binaries from the disk
<Pellescours>good news then
<Pellescours>I booted with rumpdisk
<almuhs>i'm modifying my qemu script to change disk to IDE, but gnumach continues detecting as SATA
<Pellescours>by default (disk with no option nor special driver) qemu put disk in IDE
<Pellescours>what’s your qemu command
<almuhs>OPTIONS="-s -device ahci,id=ahci1 \
<almuhs> -drive id=root,if=none,media=disk,format=raw,file=$FILE \
<almuhs> -device ide-hd,drive=root \
<almuhs> -drive id=cd,if=none,file=$CDROM,media=cdrom \
<almuhs> -device ide-cd,drive=cd,bus=ahci1.2 \
<almuhs> -boot $BOOT -accel kvm \
<almuhs> -netdev user,id=net1,net=192.168.76.0/24,dhcpstart=192.168.76.5,hostfwd=tcp:127.0.0.1:2222-:22 \
<almuhs> -device e1000,netdev=net1
<almuhs> -display gtk"
<Pellescours>I just use "-drive format=raw,cache=writeback,file=hd.img" for the disk and it’s IDE
<almuhs>yes, i set AHCI for rumpkernel, so now I'm undone this change
<Pellescours>don’t forget to update fstab and grub boot command line
<almuhs>yes, i'm trying to change grub boot command line, removing noide and replacing wd0 by hd0
<almuhs>changed the script, but the disk continues showing as SATA
<almuhs>List of arguments for Qemu
<almuhs>OPTIONS="-s \
<almuhs> -drive format=raw,cache=writeback,file=$FILE \
<almuhs> -cdrom $CDROM \
<almuhs> -boot $BOOT -accel kvm \
<almuhs> -netdev user,id=net1,net=192.168.76.0/24,dhcpstart=192.168.76.5,hostfwd=tcp:127.0.0.1:2222-:22 \
<almuhs> -device e1000,netdev=net1
<almuhs> -display gtk"
<almuhs>maybe it's necessary to reinstall to change disk to IDE
<Pellescours>no need to reinstall, I used to switch from rumpdisk to IDE gnumach often
<almuhs>ok, solved. Removed -M q35
<Pellescours>ah yes, -M q35 is the ahci driver
<almuhs>ok, now "free -h" shows 3 GiB
<almuhs>but i need to sleep. Tomorrow i will continue
<damo22>i didnt have any problem compiling rumpkernel debian package using rumpdisk to drive the disk
<damo22>i use -m 4096
<Pellescours>when you start the gnumach compiler is it "normal" to have "Bad frame pointer: ..."? Does this show a bug or is it expected in some cases?
<damo22>the gnumach compiler?
<damo22>what command did you run to get that error?
<damo22>i have a 8GB swap partition btw
<Pellescours>gnumak debugger*
<Pellescours>gnumah debugger*
<damo22>ok
<Pellescours>gnumach debugger*
<damo22>maybe you are running a distro gnumach?
<Pellescours>I have it when I compile python, I start the debugger at the middle of compilation and sometimes I get this message
<Pellescours>debian
<damo22>with stripped symbols?
<damo22>or something
<Pellescours>I’m running on a self build gnumach but it’s written >>>>> user space <<<<<<
<Pellescours>before the message
<damo22>ok
<damo22>i dont know, maybe its normal
<youpi>Pellescours: see about -fno-omit-frame-pointer
<youpi>we build glibc and hurd with it, but the rest of debian we don't
<youpi>it's questioned whether the whole debian (not only hurd) should be built with it
<youpi>on archs that have a lot of registers, it wouldn't hurt, and fix such issue for stack unwinding
<solid_black>hi all!
<azert>Hi solid_black!
<azert>Mach Port Translation Type Register?
<azert67>1st of April.. what a fool am i
<azert69>So what is the use of MACH_MSG_TYPE_COPY_SEND_ONCE
<azert69>?
<solid_black>azert: to violate the entire idea/purpose of send-once rights? :D
<solid_black>I was hoping that if the idea of copying send-once rights wasn't bonkers enough, at least MPTTR_EL1 would give it away ;)
<azert40>solid_black: haha could be made a privileged operation. That can be achieved by opening a specific device. Root should be allowed to do everything
<solid_black>open /dev/mem and the world's your oyster :)
<azert40>MACH_MSG_TYPE_COPY_RECEIVE? Why not!
<solid_black>yeah, but as I said in the commit message, that's not easily implementable, since Mach relies on there only being a single receive right in a number of places
<Pellescours>I made progress with my compilation of python that make hurd freeze completely
<Pellescours>1st when it freeze it’s during a step that use lto programm, then when it freeze if I type characters on the console, nothing is displayed but I can full the gnumach keyboard buffer (after some number of types, a message is displayed in the gnumach console)
<solid_black>so can you interrupt it in GDB and see what's going on?
<Pellescours>Finally, and probably the most interresting place. I compile during more than 5 hours, again and again (in a loop) python and no hang, it was when I enabled the kernel debugger
<Pellescours>I wanted to enable kdb to be able to debug at the hang time
<solid_black>so, build without KDB, and use GDB to debug the hang
<Pellescours>how can I use gdb to debug it? I mean to compile I run make that will launch multiple commands. Should I compile until the culprit step then stop and start it manually with gdb?
<solid_black>I assume you're running GNU/Hurd in qemu; qemu has the '-s' switch to enable a built-in GDB server (aka gdbstub; you can also type something in the qemu monitor to enable it dynamically instead of passing a switch)
<solid_black>it starts a gdb server on localhost:1234
<solid_black>that you can connect to with gdb like so:
<solid_black>$ gdb -q build/gnumach
<solid_black>(gdb) target remote :1234
<solid_black>from there, you can run/pause/step, view stacks and variables and memory, etc
<solid_black>does that make sense?
<Pellescours>yess
<Pellescours>solid_black: were the security issue you found in gnumach patched? I remember a privilege escalation one month ago
<solid_black>nope, still there
<solid_black>nobody seems interested enough in 0-day gnumach issues to even ask me what the issue was
<Pellescours>I am
<solid_black>(I described v1 of the exploit (which was already patched by Samuel, so it's effectively public) to Pellescours in PM)
<Pellescours>♥
<Pellescours>♥
<Pellescours>I tink I’m in a situation where the bug was triggered
<Pellescours>Ah no
<Pellescours>I reproduced it
<solid_black>yay
<Pellescours>0xc1017c3e in machine_idle (cpu=0) at ../i386/i386at/model_dep.c:242
<Pellescours>242 in ../i386/i386at/model_dep.c
<Pellescours>(gdb) bt
<Pellescours>#0 0xc1017c3e in machine_idle (cpu=0) at ../i386/i386at/model_dep.c:242
<Pellescours>#1 0xc103917a in idle_thread_continue () at ../kern/sched_prim.c:1680
<Pellescours>#2 0xc103857a in thread_continue (old_thread=0xf588ee60) at ../kern/sched_prim.c:845
<Pellescours>#3 0xc10497dd in Thread_continue () at ../i386/i386/cswitch.S:96
<solid_black>ok, so it's not blocked in the kernel
<solid_black>nor busy-waiting in userland
<Pellescours>I need to go, I’ll be back in 3 hours
<Pellescours>What does the console not responding to input ("kbd is full" message is printed if I type a lot of keys)
<solid_black>that means nothing in userland is reading the input
<solid_black>the translator sitting on /dev/console is supposed to be doing that
<Pellescours>if proc translator dies, can it cause that issue ?
<solid_black>if proc dies, everything should die
<solid_black>we'll debug this once you're back
<Pellescours>+1
<azert>I wonder for what use cases people at Apple implemented MACH_MSG_TYPE_COPY_RECEIVE as well as the DISPOSE message types
<azert>apparently Safari uses Mach ipc prolifically https://googleprojectzero.blogspot.com/2023/10/an-analysis-of-an-in-the-wild-ios-safari-sandbox-escape.html?m=1
<solid_black>I don't know
<solid_black>I always thought the DISPOSE port dispositions would destroy your right, and the receiver just wouldn't get anything in its place
<solid_black>but I've never seen them used
<solid_black>and now that I'm looking, I don't even see the DISPOSE dispositions being implemented anywhere in XNU
<Pellescours>re
<Pellescours>I discovered that compiling gnumach with or without debugger doesn’t change anything. For my other tests I was running with debugger enabled, I was just not aware of that as the debugger didn’t started when I typed ctrl+alt+d (as console as not consumming my keys)
<solid_black>Pellescours: good, then enable KDB and you should be able to see what tasks/threads are running from there
<Pellescours>I need to redo it but I think I was able to do list task and list thread just before the hang (I typed continue and then hang)
<Pellescours>There is 7 tasks but not of them seems to be about compilation
<solid_black>so now that it's hanging, can't you bring up the debugger again?
<Pellescours>no, the input keys are not taken in account
<solid_black>hmm
<solid_black>pretty sure machine_idle must run with interrupts unmasked
<solid_black>GDB it is then
<solid_black>let's see if you can forcefully enter KDB from GDB by the way
<solid_black>try to connect gdb and 'p kdb_kintr()'
<solid_black>though that'd probably fail because it won't find the interrupt handler stackframe, don't do that
<Pellescours>I restarted the build and started kdb at the step that hang but before the hang
<Pellescours>I see lto1 process with 2 threads: "0 (...) R....F" and "1 (...).W.O.. (mach_msg_continue) 0"
<Pellescours>but when I started the debugger, I got a lot of messages "no memory is assigned at address ..." and the last line is 0x0()
<Pellescours>it did not freeze this time, restarting
<azert>I’m not sure and I don’t know either. But out of my imagination copying receive rights might be useful for sending them to sandboxed processes that cannot make any port for sandboxing reasons
<azert>But I think gnumach doesn’t support these kind of tasks
<Pellescours>I think I’m in the debugger just before the hang
<Pellescours>when I do show tasks, have gnumach (with 8 threads)
<Pellescours>ah show all tasks show more stuff
<Pellescours>I can see a rumpdisk thread in exception_raise_continue, one in ext2fs in vm_fault_continue
<Pellescours>otherwise there is a lot of threads in mach_msg_continue or mach_msg_receive_continue
<Pellescours>one proc thread is also in vm_fault_continue