!xmLtiCaAJxfhURjrXl:matrix.org

NixOS RISC-V

196 Members
NixOS on RISC-V https://wiki.nixos.org/wiki/RISC-V https://pad.lassul.us/NixOS-riscv64-linux https://github.com/orgs/NixOS/teams/risc-v58 Servers

Load older messages


SenderMessageTime
12 Nov 2025
@rosscomputerguy:matrix.orgTristan RossOf the PHDR?06:01:03
@rosscomputerguy:matrix.orgTristan Ross

ls works so presumably, it should look like this:

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000010040 0x0000000000010040
                 0x0000000000000230 0x0000000000000230  R      0x8
  RISCV_ATTRIBUT 0x000000000012b89a 0x0000000000000000 0x0000000000000000
                 0x0000000000000057 0x0000000000000000  R      0x1
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  LOAD           0x0000000000000000 0x0000000000010000 0x0000000000010000
                 0x000000000011c610 0x000000000011c610  R E    0x1000
  INTERP         0x0000000000000270 0x0000000000010270 0x0000000000010270
                 0x000000000000005c 0x000000000000005c  R      0x1
      [Requesting program interpreter: /nix/store/kg61gdq4svvph0c4pcsf867r8nkbiqs7-bootstrap-tools/lib/ld-linux-riscv64-lp64d.so.1]
  NOTE           0x00000000000002e4 0x00000000000102e4 0x00000000000102e4
                 0x0000000000000044 0x0000000000000044  R      0x4
  GNU_EH_FRAME   0x00000000001015b0 0x00000000001115b0 0x00000000001115b0
                 0x00000000000030bc 0x00000000000030bc  R      0x4
  LOAD           0x000000000011cf68 0x000000000012df68 0x000000000012df68
                 0x000000000000e920 0x0000000000023ba0  RW     0x1000
  GNU_RELRO      0x000000000011cf68 0x000000000012df68 0x000000000012df68
                 0x000000000000a098 0x000000000000a098  R      0x1
  DYNAMIC        0x0000000000126dd0 0x0000000000137dd0 0x0000000000137dd0
                 0x0000000000000230 0x0000000000000230  RW     0x8
06:01:56
@joerg:thalheim.ioMic92But i am not super familiar with virtual addresses on RISC-V to be honest. So i don't which adresses are acceptable on that architecture. You should consult the RISC-V os spec06:02:33
@rosscomputerguy:matrix.orgTristan RossOh...06:02:44
@joerg:thalheim.ioMic92Maybe for now compare it with other binaries 06:03:16
@joerg:thalheim.ioMic92And it's also hard to read for me. You want to look at what load addresses are requested 06:05:14
@joerg:thalheim.ioMic92Is riscv 4k page aligned. Usually the first page should not be mapped in userspace 06:06:27
@rosscomputerguy:matrix.orgTristan Ross

When I updated bootstrap-tools on my clone, I got awk to work and it works with this:

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
                 0x00000000000002a0 0x00000000000002a0  R      0x8
  RISCV_ATTRIBUT 0x00000000000b1022 0x0000000000000000 0x0000000000000000
                 0x000000000000006a 0x0000000000000000  R      0x1
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x00000000000ab84c 0x00000000000ab84c  R E    0x1000
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  GNU_EH_FRAME   0x0000000000098fc8 0x0000000000098fc8 0x0000000000098fc8
                 0x00000000000017a4 0x00000000000017a4  R      0x4
  NOTE           0x00000000000ab82c 0x00000000000ab82c 0x00000000000ab82c
                 0x0000000000000020 0x0000000000000020  R      0x4
  LOAD           0x00000000000ac848 0x00000000000ac848 0x00000000000ac848
                 0x00000000000047c8 0x000000000000c818  RW     0x1000
  GNU_RELRO      0x00000000000ac848 0x00000000000ac848 0x00000000000ac848
                 0x00000000000037b8 0x00000000000037b8  R      0x1
  DYNAMIC        0x00000000000af2d0 0x00000000000af2d0 0x00000000000af2d0
                 0x0000000000000230 0x0000000000000230  RW     0x8
  INTERP         0x00000000000b2000 0x00000000000ba000 0x00000000000ba000
                 0x000000000000005c 0x000000000000005c  R      0x1
      [Requesting program interpreter: /nix/store/95y6xmfgcvgxjmba9xm6ccxxnf6i61pw-bootstrap-tools/lib/ld-linux-riscv64-lp64d.so.1]
  LOAD           0x00000000000b2000 0x00000000000ba000 0x00000000000ba000
                 0x0000000000000060 0x0000000000000060  RW     0x1000
  LOAD           0x00000000000b3000 0x00000000000bb000 0x00000000000bb000
                 0x00000000000019d0 0x00000000000019d0  RW     0x1000

So maybe the virt addr PHDR isn't as important

06:06:33
@joerg:thalheim.ioMic92* Is riscv 4k page aligned? Usually the first page should not be mapped in userspace 06:06:36
@joerg:thalheim.ioMic92Not sure if this is your thing, but llms are pretty good at having read all of the cpu architecture specs and have found in the past for me pretty quickly oddities in readelf. 06:09:20
@rosscomputerguy:matrix.orgTristan RossI've been rubber ducking ChatGPT since Sunday with this problem06:09:44
@rosscomputerguy:matrix.orgTristan RossIt believe AppArmor is the problem, despite me disabling it thinking that was the problem06:10:10
@joerg:thalheim.ioMic92Feels unlikely. 06:10:53
@joerg:thalheim.ioMic92You would see the audit log in dmesg06:11:16
@rosscomputerguy:matrix.orgTristan RossYeah, which I don't but ChatGPT is just confident it's AppArmor lol06:11:33
@joerg:thalheim.ioMic92It's definitely the mmap syscall requesting that returns eperm 06:12:33
@joerg:thalheim.ioMic92You could even ask it to write an mmap call on these parameters to reproduce it06:13:30
@joerg:thalheim.ioMic92I just don't know which load segment is off. My brain cannot parse these unaligned columns from the phone06:14:34
@rosscomputerguy:matrix.orgTristan Ross
$ zcat /proc/config.gz | grep CONFIG_STRICT_KERNEL_RWX
CONFIG_STRICT_KERNEL_RWX=y

Could this be a problem?

06:14:54
@rosscomputerguy:matrix.orgTristan RossChatGPT says it could be lol06:15:06
@joerg:thalheim.ioMic92No we don't map as executable here if i interpret correctly06:16:06
@joerg:thalheim.ioMic92 mmap(0xf000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = -1 EPERM (Operation not permitted) 06:16:19
@joerg:thalheim.ioMic92Only read/write06:16:32
@joerg:thalheim.ioMic92Figure out what 3 is here06:16:59
@joerg:thalheim.ioMic92Run strace with -yy06:17:15
@dramforever:matrix.orgdramforever0xf000 is sus06:17:29
@joerg:thalheim.ioMic92This gives you file descriptors06:17:33
@dramforever:matrix.orgdramforeveris it below the minimum address limit06:17:38
@joerg:thalheim.ioMic92
In reply to @dramforever:matrix.org
0xf000 is sus
I agree
06:17:47
@joerg:thalheim.ioMic92What's allowed on RISC-V? 06:18:05

Show newer messages


Back to Room ListRoom Version: 10