Re: [Bug (?) ld]: ld interprets % weirdly

2023-06-11 Thread Theo de Raadt
Claudio Jeker  wrote:

> What a stupid interface, lets rebuild mktemp(2) and not learn from
> history. It is not like this is new unless you think 30years is new...
> 
> Humanity is surely doomed

Yes, the next generation will face big challenges.




After update, vim reports undefined symbols in libruby32.so

2023-06-11 Thread Why 42? The lists account.


Hi All,

FYI, After running "sysupgrade -s" + "pkg_add -u" earlier today, I now
see these messages when I exit vim:

mjoelnir:awk 11.06 18:42:45 % vi substrtest.awk
...
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_Backtrace'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_GetIP'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_GetCFA'
vim:/usr/local/lib/libruby32.so: undefined symbol 
'_Unwind_FindEnclosingFunction'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_GetDataRelBase'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_GetTextRelBase'
vim:/usr/local/lib/libruby32.so: undefined symbol 
'_Unwind_GetLanguageSpecificData'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_GetIPInfo'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_GetRegionStart'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_SetGR'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_SetIP'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_DeleteException'
vim:/usr/local/lib/libruby32.so: undefined symbol '_Unwind_RaiseException'

% uname -a
OpenBSD mjoelnir.fritz.box 7.3 GENERIC.MP#1230 amd64

% pkg_info | grep vim
vim-9.0.1536p0-no_x11-perl-python3-ruby vi clone, many additional features
vim-spell-de-9.0German spell-check files for Vim

It looks as if I received new versions of both ruby and vim:
# grep ruby /var/log/messages
Jun 11 13:47:01 mjoelnir pkg_add: Added ruby-3.2.2
Jun 11 13:52:56 mjoelnir pkg_add: Added ruby-3.1.4->3.1.4
Jun 11 13:53:22 mjoelnir pkg_add: Added 
vim-9.0.1536-no_x11-perl-python3-ruby->9.0.1536p0-no_x11-perl-python3-ruby
Jun 11 14:06:06 mjoelnir pkg_delete: Removed ruby-3.1.4



Re: About Intel C3000 eMMC

2023-06-11 Thread Valdrin MUJA
Thanks, Aaron, for your review.
But when I looked at the tech@ mailing listing description, I thought it would 
be better to continue here.

I installed it on a USB disk, then I sent a compiled kernel here with the 
option SDMMC_DEBUG parameter.

I've attached dmesg, pcidump outputs and /var/db/acpi via this e-mail.
Maybe it can be a starting point for a developer who wants to look.
Thank you for reading.

From: Aaron Mason 
Sent: Sunday, June 11, 2023 14:45
To: Valdrin MUJA 
Cc: MISC@openbsd.org 
Subject: Re: About Intel C3000 eMMC

On Sun, Jun 11, 2023 at 9:33 PM Aaron Mason  wrote:
> Looks like it's picking it up, but can't enable it - from the attached dmesg:
>
> sdhc0 at pci0 dev 28 function 0 "Intel C3000 eMMC" rev 0x11: apic 2 int 16
> sdhc0: SDHC 3.0, 200 MHz base clock
> sdmmc0 at sdhc0: 8-bit, sd high-speed, mmc high-speed, ddr52, dma
> [REDACTED]
> sdmmc0: can't enable card
>
> Maybe getting some debugging from that driver will help a dev - I
> don't know the option off hand but I'll have a look unless someone
> more knowledgeable can point you in the right direction.
>
> --
> Aaron Mason - Programmer, open source addict
> I've taken my software vows - for beta or for worse

Ok so the option is SDMMC_DEBUG - if you're able, try rebuilding the
kernel but add this line to the config file:

option SDMMC_DEBUG

Send the output to tech@ rather than here - someone there can have a
look and see where it's tripping up.

--
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse


acpi.tar.gz
Description: acpi.tar.gz
OpenBSD 7.3-stable (sdmmcDebug) #0: Sun Jun 11 12:42:36 UTC 2023
root@73.openbsd.local:/usr/src/sys/arch/amd64/compile/sdmmcDebug
real mem = 8508928000 (8114MB)
avail mem = 8231632896 (7850MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.0 @ 0x7c582000 (35 entries)
bios0: vendor INSYDE Corp. version "CORDOBA-02.02.00.00-SLt" date 2021-10-31
bios0: Silicom 80500-0214-G03-SL00A
efi0 at bios0: UEFI 2.5
efi0: Insyde Jul 27 2021 16:55:45 rev 0x0
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP UEFI UEFI BDAT BOOT HPET APIC MCFG SSDT DMAR DBG2
acpi0: wakeup devices VRP2(S4) PXSX(S4) PEX0(S4) PXSX(S4) PEX1(S4) PXSX(S4) 
PEX2(S4) PXSX(S4) PEX3(S4) PXSX(S4) PEX4(S4) PXSX(S4) PEX5(S4) PXSX(S4) 
PEX6(S4) PXSX(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 2399 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 4 (boot processor)
cpu0: Intel(R) Atom(TM) CPU C3558 @ 2.20GHz, 2200.01 MHz, 06-5f-01
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,CX16,xTPR,PDCM,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SMEP,ERMS,MPX,RDSEED,SMAP,CLFLUSHOPT,PT,SHA,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 2MB 64b/line 
16-way L2 cache
cpu0: smt 0, core 2, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 25MHz
cpu0: mwait min=64, max=64, C-substates=0.2.0.2, IBE
cpu1 at mainbus0: apid 12 (application processor)
cpu1: Intel(R) Atom(TM) CPU C3558 @ 2.20GHz, 2200.00 MHz, 06-5f-01
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,CX16,xTPR,PDCM,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SMEP,ERMS,MPX,RDSEED,SMAP,CLFLUSHOPT,PT,SHA,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu1: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 2MB 64b/line 
16-way L2 cache
cpu1: smt 0, core 6, package 0
cpu2 at mainbus0: apid 16 (application processor)
cpu2: Intel(R) Atom(TM) CPU C3558 @ 2.20GHz, 2200.00 MHz, 06-5f-01
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,CX16,xTPR,PDCM,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SMEP,ERMS,MPX,RDSEED,SMAP,CLFLUSHOPT,PT,SHA,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu2: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 2MB 64b/line 
16-way L2 cache
cpu2: smt 0, core 8, package 0
cpu3 at mainbus0: apid 24 (application processor)
cpu3: Intel(R) Atom(TM) CPU C3558 @ 2.20GHz, 2200.00 MHz, 06-5f-01
cpu3: 

Re: About Intel C3000 eMMC

2023-06-11 Thread Aaron Mason
On Sun, Jun 11, 2023 at 9:33 PM Aaron Mason  wrote:
> Looks like it's picking it up, but can't enable it - from the attached dmesg:
>
> sdhc0 at pci0 dev 28 function 0 "Intel C3000 eMMC" rev 0x11: apic 2 int 16
> sdhc0: SDHC 3.0, 200 MHz base clock
> sdmmc0 at sdhc0: 8-bit, sd high-speed, mmc high-speed, ddr52, dma
> [REDACTED]
> sdmmc0: can't enable card
>
> Maybe getting some debugging from that driver will help a dev - I
> don't know the option off hand but I'll have a look unless someone
> more knowledgeable can point you in the right direction.
>
> --
> Aaron Mason - Programmer, open source addict
> I've taken my software vows - for beta or for worse

Ok so the option is SDMMC_DEBUG - if you're able, try rebuilding the
kernel but add this line to the config file:

option SDMMC_DEBUG

Send the output to tech@ rather than here - someone there can have a
look and see where it's tripping up.

-- 
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse



Re: [Bug (?) ld]: ld interprets % weirdly

2023-06-11 Thread Andinus


Theo de Raadt @ 2023-06-11 00:01 -06:

> I assume you are on an architecture where the linker is LLVM ld,
> otherwise known as ld-lld in OpenBSD (some older architectures
> still use ld-bfd).

Yes, seems so.

uname -a:
OpenBSD cadmium.cadmium 7.3 GENERIC.MP#1125 amd64

ld --version:
LLD 13.0.0 (compatible with GNU linkers)

> [...]
> It apppears in the LLVM universe if you try to create a file with % in the
> name, it has a different interpretation of what that % means, different than
> what you want it to mean.
>
> https://docs.hdoc.io/hdoc/llvm-project/f1FB0DB2307A8013C.html
>
> Other than that, I can find no documentation.

I see, makes sense. So the solution would be to avoid '%' in path right?

> Andinus  wrote:
>
>> Hello,
>>
>> Context: https://github.com/ugexe/zef/issues/457#issuecomment-1586021352
>>
>> I'm not familiar with how `ld` works so I'm not sure how to create a
>> minimal reproducible example.
>>
>> - zef is Raku's module manager
>> - Raku: formerly Perl 6
>>
>> When I try to run `zef install --debug Crypt::Bcrypt` it always fails in
>> build step with this error:
>>
>> ```
>> ...
>> Jun 01 19:01:41 [Digest::SHA1::Native] clang -shared -fPIC  -O3 -DNDEBUG 
>> -Wl,-rpath,"//usr/local/rakudo/lib" -o 
>> /tmp/.zef/1685626244.6528/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so
>>  sha1.o
>> Jun 01 19:01:41 [Digest::SHA1::Native] ld: error: cannot open output file 
>> /tmp/.zef/1685626244.6528/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so:
>>  No such file or directory
>> Jun 01 19:01:41 [Digest::SHA1::Native] clang: error: linker command failed 
>> with exit code 1 (use -v to see invocation)
>> ...
>> ```
>>
>> This is how `ld` is invoked, the issue seems to be with '%' in directory
>> name:
>> ```
>> andinus@cadmium /t/.z/1/D/raku-digest-sha1-native-master> "/usr/bin/ld" 
>> --eh-frame-hdr -Bdynamic -shared -o 
>> /tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so
>>  /usr/lib/crtbeginS.o -L/usr/lib -rpath //usr/local/rakudo/lib sha1.o 
>> -lcompiler_rt -lcompiler_rt /usr/lib/crtendS.o
>> ld: error: cannot open output file 
>> /tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so:
>> No such file or directory
>> ```
>>
>> Quoting the path doesn't work, even escaping '%' with \ doesn't seem to
>> work. What works is removing % from path altogether.
>>
>> Here is ktrace output:
>> ```
>>  23633 ld   NAMI  
>> "/tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsh\
>> a1.so"
>>  23633 ld   RET   stat -1 errno 2 No such file or directory
>>  23633 ld   CALL  kbind(0x7f0992e23f18,24,0xf17447ef4e72dc56)
>>  23633 ld   RET   kbind 0
>>  23633 ld   CALL  
>> open(0x29843bc00,0x10a02,0666)
>>  23633 ld   NAMI  
>> "/tmp/.zef/1686382217.68953/Digest73A43ASHA143A73ANativef3Aver73C0.0613E23Aauth73Cgithuba3Abduggan13E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsh\
>> a1.so.tmpc5eb445"
>>  23633 ld   RET   open -1 errno 2 No such file or directory
>>  23633 ld   CALL  kbind(0x7f0992e244e8,24,0xf17447ef4e72dc56)
>>  23633 ld   RET   kbind 0
>> .
>> .
>> .
>>  23633 ld   RET   kbind 0
>>  23633 ld   CALL  write(2,0x7f0992e24501,0x2)
>>  23633 ld   GIO   fd 2 wrote 2 bytes
>>"ld"
>>  23633 ld   RET   write 2
>>  23633 ld   CALL  write(2,0x3a9837,0x2)
>>  23633 ld   GIO   fd 2 wrote 2 bytes
>>": "
>>  23633 ld   RET   write 2
>>  23633 ld   CALL  write(2,0x336c72,0x7)
>>  23633 ld   GIO   fd 2 wrote 7 bytes
>>"error: "
>>  23633 ld   RET   write 7
>>  23633 ld   CALL  write(2,0x4a96e1,0x18)
>>  23633 ld   GIO   fd 2 wrote 24 bytes
>>"cannot open output file "
>>  23633 ld   RET   write 24/0x18
>>  23633 ld   CALL  write(2,0x7f0992e25008,0xa9)
>>  23633 ld   GIO   fd 2 wrote 169 bytes
>>
>> "/tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so"
>>  23633 ld   RET   write 169/0xa9
>>  23633 ld   CALL  write(2,0x3a9837,0x2)
>>  23633 ld   GIO   fd 2 wrote 2 bytes
>>": "
>>  23633 ld   RET   write 2
>>  23633 ld   CALL  write(2,0x298433740,0x19)
>>  23633 ld   GIO   fd 2 wrote 25 bytes
>>"No such file or directory"
>>  23633 ld   RET   write 25/0x19
>>  23633 ld   CALL  write(2,0x40431f,0x1)
>>  23633 ld   GIO   fd 2 wrote 1 bytes
>>"
>>

Re: About Intel C3000 eMMC

2023-06-11 Thread Aaron Mason
On Sun, Jun 11, 2023 at 9:16 PM Valdrin MUJA  wrote:
>
> Hello OpenBSD,
>
> I'm trying to install OpenBSD 7.3 on a Cordoba Edge Gateway CPE(*) device 
> manufactured by Silicom-USA. However, OpenBSD does not recognize the Intel 
> C3000 eMMC (SOC type) disk that comes on it.
> Is there a way to run this?
> Thanks.
>
> Also you can find the dmesg output in the attachment of this email.
>
> (*) 
> https://www.silicom-usa.com/pr/4g-5g-products/4g-5g-appliances/cordoba-edge-gateway-cpe/
>

Looks like it's picking it up, but can't enable it - from the attached dmesg:

sdhc0 at pci0 dev 28 function 0 "Intel C3000 eMMC" rev 0x11: apic 2 int 16
sdhc0: SDHC 3.0, 200 MHz base clock
sdmmc0 at sdhc0: 8-bit, sd high-speed, mmc high-speed, ddr52, dma
[REDACTED]
sdmmc0: can't enable card

Maybe getting some debugging from that driver will help a dev - I
don't know the option off hand but I'll have a look unless someone
more knowledgeable can point you in the right direction.

-- 
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse



About Intel C3000 eMMC

2023-06-11 Thread Valdrin MUJA
Hello OpenBSD,

I'm trying to install OpenBSD 7.3 on a Cordoba Edge Gateway CPE(*) device 
manufactured by Silicom-USA. However, OpenBSD does not recognize the Intel 
C3000 eMMC (SOC type) disk that comes on it.
Is there a way to run this?
Thanks.

Also you can find the dmesg output in the attachment of this email.

(*) 
https://www.silicom-usa.com/pr/4g-5g-products/4g-5g-appliances/cordoba-edge-gateway-cpe/

OpenBSD 7.3 (RAMDISK_CD) #1063: Sat Mar 25 10:41:49 MDT 2023
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/RAMDISK_CD
real mem = 8508928000 (8114MB)
avail mem = 8247029760 (7864MB)
random: good seed from bootblocks
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.0 @ 0x7c582000 (35 entries)
bios0: vendor INSYDE Corp. version "CORDOBA-02.02.00.00-SLt" date 2021-10-31
bios0: Silicom 80500-0214-G03-SL00A
acpi0 at bios0: ACPI 5.0
acpi0: tables DSDT FACP UEFI UEFI BDAT BOOT HPET APIC MCFG SSDT DMAR DBG2
acpihpet0 at acpi0: 2399 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 4 (boot processor)
cpu0: Intel(R) Atom(TM) CPU C3558 @ 2.20GHz, 2200.00 MHz, 06-5f-01
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,SDBG,CX16,xTPR,PDCM,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,FSGSBASE,TSC_ADJUST,SMEP,ERMS,MPX,RDSEED,SMAP,CLFLUSHOPT,PT,SHA,MD_CLEAR,IBRS,IBPB,STIBP,SSBD,SENSOR,ARAT,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 24KB 64b/line 6-way D-cache, 32KB 64b/line 8-way I-cache, 2MB 64b/line 
16-way L2 cache
cpu0: apic clock running at 25MHz
cpu0: mwait min=64, max=64, C-substates=0.2.0.2, IBE
cpu at mainbus0: not configured
cpu at mainbus0: not configured
cpu at mainbus0: not configured
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 120 pins
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (VRP2)
acpiprt2 at acpi0: bus -1 (PEX0)
acpiprt3 at acpi0: bus 17 (PEX1)
acpiprt4 at acpi0: bus 8 (PEX2)
acpiprt5 at acpi0: bus 4 (PEX3)
acpiprt6 at acpi0: bus 5 (PEX4)
acpiprt7 at acpi0: bus 6 (PEX5)
acpiprt8 at acpi0: bus 7 (PEX6)
acpiprt9 at acpi0: bus 9 (PEX7)
acpiprt10 at acpi0: bus 3 (VRP0)
acpiprt11 at acpi0: bus 2 (VRP1)
acpipci0 at acpi0 PCI0: 0x0010 0x0011 0x
"PNP0003" at acpi0 not configured
acpicmos0 at acpi0
com0 at acpi0 IUR3 addr 0x3f8/0x8 irq 16: ns16550a, 16 byte fifo
com0: console
com1 at acpi0 IUR4 addr 0x2f8/0x8 irq 17: ns16550a, 16 byte fifo
"PNP0C33" at acpi0 not configured
"PNP0C0C" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
"IFX0102" at acpi0 not configured
"INTC3000" at acpi0 not configured
acpicpu at acpi0 not configured
acpipwrres at acpi0 not configured
acpitz at acpi0 not configured
pci0 at mainbus0 bus 0
0:31:5: mem address conflict 0xfe01/0x1000
0:31:7: mem address conflict 0xfb00/0x80
pchb0 at pci0 dev 0 function 0 "Intel C3000 Host" rev 0x11
pchb1 at pci0 dev 4 function 0 "Intel C3000 GLREG" rev 0x11
"Intel C3000 RCEC" rev 0x11 at pci0 dev 5 function 0 not configured
ppb0 at pci0 dev 6 function 0 "Intel C3000 PCIE" rev 0x11
pci1 at ppb0 bus 1
"Intel C3000 QAT" rev 0x11 at pci1 dev 0 function 0 not configured
ppb1 at pci0 dev 10 function 0 "Intel C3000 PCIE" rev 0x11
pci2 at ppb1 bus 17
ppb2 at pci0 dev 11 function 0 "Intel C3000 PCIE" rev 0x11
pci3 at ppb2 bus 8
ppb3 at pci0 dev 12 function 0 "Intel C3000 PCIE" rev 0x11
pci4 at ppb3 bus 4
igc0 at pci4 dev 0 function 0 "Intel I225-V" rev 0x03, msix, 1 queue, address 
90:ec:77:23:6f:e9
ppb4 at pci0 dev 14 function 0 "Intel C3000 PCIE" rev 0x11
pci5 at ppb4 bus 5
igc1 at pci5 dev 0 function 0 "Intel I225-V" rev 0x03, msix, 1 queue, address 
90:ec:77:23:6f:ea
ppb5 at pci0 dev 15 function 0 "Intel C3000 PCIE" rev 0x11
pci6 at ppb5 bus 6
igc2 at pci6 dev 0 function 0 "Intel I225-V" rev 0x03, msix, 1 queue, address 
90:ec:77:23:6f:eb
ppb6 at pci0 dev 16 function 0 "Intel C3000 PCIE" rev 0x11
pci7 at ppb6 bus 7
igc3 at pci7 dev 0 function 0 "Intel I225-V" rev 0x03, msix, 1 queue, address 
90:ec:77:23:6f:ec
ppb7 at pci0 dev 17 function 0 "Intel C3000 PCIE" rev 0x11
pci8 at ppb7 bus 9
"Intel C3000 SMBus" rev 0x11 at pci0 dev 18 function 0 not configured
xhci0 at pci0 dev 21 function 0 "Intel C3000 xHCI" rev 0x11: msi, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 
addr 1
ppb8 at pci0 dev 22 function 0 "Intel C3000 PCIE" rev 0x11
pci9 at ppb8 bus 3
3:0:0: rom address conflict 0xfff8/0x8
3:0:1: rom address conflict 0xfff8/0x8
ix0 at pci9 dev 0 function 0 "Intel X553 SFP+" rev 0x11, msix, 1 queue, address 
90:ec:77:23:6f:e7
ix1 at pci9 dev 0 function 1 "Intel X553 SFP+" rev 0x11, msix, 1 queue, address 
90:ec:77:23:6f:e8
ppb9 at pci0 dev 23 function 0 "Intel C3000 PCIE" rev 0x11
pci10 at ppb9 bus 2
2:0:0: rom address conflict 0xfff8/0x8
2:0:1: rom address conflict 

Re: [Bug (?) ld]: ld interprets % weirdly

2023-06-11 Thread Theo de Raadt
Claudio Jeker  wrote:

> On Sun, Jun 11, 2023 at 12:01:04AM -0600, Theo de Raadt wrote:
> > I assume you are on an architecture where the linker is LLVM ld,
> > otherwise known as ld-lld in OpenBSD (some older architectures
> > still use ld-bfd).
> > 
> > In llvm/lib/Support/Path.cpp, there is code that acts just like you 
> > describe:
> > 
> > void createUniquePath(const Twine , SmallVectorImpl ,
> >   bool MakeAbsolute) {
> > ...
> >   // Replace '%' with random chars.
> >   for (unsigned i = 0, e = ModelStorage.size(); i != e; ++i) {
> > if (ModelStorage[i] == '%')
> >   ResultPath[i] = "0123456789abcdef"[sys::Process::GetRandomNumber() & 
> > 15];
> >   }
> > 
> > 
> > It apppears in the LLVM universe if you try to create a file with % in the
> > name, it has a different interpretation of what that % means, different than
> > what you want it to mean.
> > 
> > https://docs.hdoc.io/hdoc/llvm-project/f1FB0DB2307A8013C.html
> > 
> > Other than that, I can find no documentation.
>  
> What a stupid interface, lets rebuild mktemp(2) and not learn from
> history. It is not like this is new unless you think 30years is new...
> 
> Humanity is surely doomed

But it is worse.  It is putting automatic TOCTOU into an unexpected place.



Re: [Bug (?) ld]: ld interprets % weirdly

2023-06-11 Thread Claudio Jeker
On Sun, Jun 11, 2023 at 12:01:04AM -0600, Theo de Raadt wrote:
> I assume you are on an architecture where the linker is LLVM ld,
> otherwise known as ld-lld in OpenBSD (some older architectures
> still use ld-bfd).
> 
> In llvm/lib/Support/Path.cpp, there is code that acts just like you describe:
> 
> void createUniquePath(const Twine , SmallVectorImpl ,
>   bool MakeAbsolute) {
> ...
>   // Replace '%' with random chars.
>   for (unsigned i = 0, e = ModelStorage.size(); i != e; ++i) {
> if (ModelStorage[i] == '%')
>   ResultPath[i] = "0123456789abcdef"[sys::Process::GetRandomNumber() & 
> 15];
>   }
> 
> 
> It apppears in the LLVM universe if you try to create a file with % in the
> name, it has a different interpretation of what that % means, different than
> what you want it to mean.
> 
> https://docs.hdoc.io/hdoc/llvm-project/f1FB0DB2307A8013C.html
> 
> Other than that, I can find no documentation.
 
What a stupid interface, lets rebuild mktemp(2) and not learn from
history. It is not like this is new unless you think 30years is new...

Humanity is surely doomed
-- 
:wq Claudio



Re: [Bug (?) ld]: ld interprets % weirdly

2023-06-11 Thread Theo de Raadt
I assume you are on an architecture where the linker is LLVM ld,
otherwise known as ld-lld in OpenBSD (some older architectures
still use ld-bfd).

In llvm/lib/Support/Path.cpp, there is code that acts just like you describe:

void createUniquePath(const Twine , SmallVectorImpl ,
  bool MakeAbsolute) {
...
  // Replace '%' with random chars.
  for (unsigned i = 0, e = ModelStorage.size(); i != e; ++i) {
if (ModelStorage[i] == '%')
  ResultPath[i] = "0123456789abcdef"[sys::Process::GetRandomNumber() & 15];
  }


It apppears in the LLVM universe if you try to create a file with % in the
name, it has a different interpretation of what that % means, different than
what you want it to mean.

https://docs.hdoc.io/hdoc/llvm-project/f1FB0DB2307A8013C.html

Other than that, I can find no documentation.


Andinus  wrote:

> Hello,
> 
> Context: https://github.com/ugexe/zef/issues/457#issuecomment-1586021352
> 
> I'm not familiar with how `ld` works so I'm not sure how to create a
> minimal reproducible example.
> 
> - zef is Raku's module manager
> - Raku: formerly Perl 6
> 
> When I try to run `zef install --debug Crypt::Bcrypt` it always fails in
> build step with this error:
> 
> ```
> ...
> Jun 01 19:01:41 [Digest::SHA1::Native] clang -shared -fPIC  -O3 -DNDEBUG 
> -Wl,-rpath,"//usr/local/rakudo/lib" -o 
> /tmp/.zef/1685626244.6528/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so
>  sha1.o
> Jun 01 19:01:41 [Digest::SHA1::Native] ld: error: cannot open output file 
> /tmp/.zef/1685626244.6528/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so:
>  No such file or directory
> Jun 01 19:01:41 [Digest::SHA1::Native] clang: error: linker command failed 
> with exit code 1 (use -v to see invocation)
> ...
> ```
> 
> This is how `ld` is invoked, the issue seems to be with '%' in directory
> name:
> ```
> andinus@cadmium /t/.z/1/D/raku-digest-sha1-native-master> "/usr/bin/ld" 
> --eh-frame-hdr -Bdynamic -shared -o 
> /tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so
>  /usr/lib/crtbeginS.o -L/usr/lib -rpath //usr/local/rakudo/lib sha1.o 
> -lcompiler_rt -lcompiler_rt /usr/lib/crtendS.o
> ld: error: cannot open output file 
> /tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so:
> No such file or directory
> ```
> 
> Quoting the path doesn't work, even escaping '%' with \ doesn't seem to
> work. What works is removing % from path altogether.
> 
> Here is ktrace output:
> ```
>  23633 ld   NAMI  
> "/tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsh\
> a1.so"
>  23633 ld   RET   stat -1 errno 2 No such file or directory
>  23633 ld   CALL  kbind(0x7f0992e23f18,24,0xf17447ef4e72dc56)
>  23633 ld   RET   kbind 0
>  23633 ld   CALL  
> open(0x29843bc00,0x10a02,0666)
>  23633 ld   NAMI  
> "/tmp/.zef/1686382217.68953/Digest73A43ASHA143A73ANativef3Aver73C0.0613E23Aauth73Cgithuba3Abduggan13E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsh\
> a1.so.tmpc5eb445"
>  23633 ld   RET   open -1 errno 2 No such file or directory
>  23633 ld   CALL  kbind(0x7f0992e244e8,24,0xf17447ef4e72dc56)
>  23633 ld   RET   kbind 0
> .
> .
> .
>  23633 ld   RET   kbind 0
>  23633 ld   CALL  write(2,0x7f0992e24501,0x2)
>  23633 ld   GIO   fd 2 wrote 2 bytes
>"ld"
>  23633 ld   RET   write 2
>  23633 ld   CALL  write(2,0x3a9837,0x2)
>  23633 ld   GIO   fd 2 wrote 2 bytes
>": "
>  23633 ld   RET   write 2
>  23633 ld   CALL  write(2,0x336c72,0x7)
>  23633 ld   GIO   fd 2 wrote 7 bytes
>"error: "
>  23633 ld   RET   write 7
>  23633 ld   CALL  write(2,0x4a96e1,0x18)
>  23633 ld   GIO   fd 2 wrote 24 bytes
>"cannot open output file "
>  23633 ld   RET   write 24/0x18
>  23633 ld   CALL  write(2,0x7f0992e25008,0xa9)
>  23633 ld   GIO   fd 2 wrote 169 bytes
>
> "/tmp/.zef/1686382217.68953/Digest%3A%3ASHA1%3A%3ANative%3Aver%3C0.06%3E%3Aauth%3Cgithub%3Abduggan%3E.tar.gz/raku-digest-sha1-native-master/resources/libraries/libsha1.so"
>  23633 ld   RET   write 169/0xa9
>  23633 ld   CALL  write(2,0x3a9837,0x2)
>  23633 ld   GIO   fd 2 wrote 2 bytes
>": "
>  23633 ld   RET   write 2
>  23633 ld   CALL  write(2,0x298433740,0x19)
>  23633 ld   GIO   fd 2 wrote 25 bytes
>"No such file or directory"
>  23633 ld   RET   write 25/0x19
>  23633 ld   CALL  write(2,0x40431f,0x1)
>  23633 ld   GIO