Hello,

Is there some kind of limitation on the size of an ELF executable that can
be executed on i386?  I mean, in addition to the limits in /etc/login.conf?

Here's why I'm asking:

$ uname -a
OpenBSD t43.my.domain 6.8 GENERIC#4 i386

$ cat /etc/login.conf
[...]
default:\
        :path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/local/bin
        /usr/local/sbin:\
        :umask=022:\
        :datasize-max=infinity:\
        :datasize-cur=infinity:\
        :memoryuse-max=infinity:\
        :memoryuse-cur=infinity:\
        :memorylocked-max=infinity:\
        :memorylocked-cur=infinity:\
        :vmemoryuse-max=infinity:\
        :vmemoryuse-cur=infinity:\
        :maxproc-max=256:\
        :maxproc-cur=128:\
        :openfiles-max=1024:\
        :openfiles-cur=512:\
        :stacksize-max=infinity:\
        :stacksize-cur=infinity:\
        :localcipher=blowfish,a:\
        :tc=auth-defaults:\
        :tc=auth-ftp-defaults:
[...]

(/etc/login.conf is that way just for testing purposes...)

$ ulimit -a
time(cpu-seconds)    unlimited
file(blocks)         unlimited
coredump(blocks)     unlimited
data(kbytes)         3145728
stack(kbytes)        32768
lockedmem(kbytes)    unlimited
memory(kbytes)       unlimited
nofiles(descriptors) 512
processes            128

$ /usr/local/chrome/chrome
/bin/ksh: /usr/local/chrome/chrome: Cannot allocate memory

$ ktrace -d -i /usr/local/chrome/chrome                                        
ktrace: exec of '/usr/local/chrome/chrome' failed: Cannot allocate memory
$ kdump -X
 23578 ktrace   RET   ktrace 0
 23578 ktrace   CALL  execve(0xcf7ebfc1,0xcf7ebf10,0xcf7ebf18)
 23578 ktrace   NAMI  "/usr/local/chrome/chrome"
 23578 ktrace   RET   execve -1 errno 12 Cannot allocate memory
 23578 ktrace   CALL  mprotect(0x58b08000,0x1000,0x3<PROT_READ|PROT_WRITE>)
 23578 ktrace   RET   mprotect 0
 23578 ktrace   CALL  mprotect(0x58b08000,0x1000,0x1<PROT_READ>)
 23578 ktrace   RET   mprotect 0
 23578 ktrace   CALL  write(2,0xcf7eb818,0x8)
 23578 ktrace   GIO   fd 2 wrote 8 bytes
   0000:  6b 74 72 61 63 65 3a 20                          ktrace: 
 23578 ktrace   RET   write 8
 23578 ktrace   CALL  write(2,0xcf7eb838,0x29)
 23578 ktrace   GIO   fd 2 wrote 41 bytes
   0000:  65 78 65 63 20 6f 66 20 27 2f 75 73 72 2f 6c 6f  exec of '/usr/lo
   0010:  63 61 6c 2f 63 68 72 6f 6d 65 2f 63 68 72 6f 6d  cal/chrome/chrom
   0020:  65 27 20 66 61 69 6c 65 64                       e' failed
 23578 ktrace   RET   write 41/0x29
 23578 ktrace   CALL  write(2,0xcf7eb820,0x2)
 23578 ktrace   GIO   fd 2 wrote 2 bytes
   0000:  3a 20                                            : 
 23578 ktrace   RET   write 2
 23578 ktrace   CALL  write(2,0xcf7eb818,0x17)
 23578 ktrace   GIO   fd 2 wrote 23 bytes
   0000:  43 61 6e 6e 6f 74 20 61 6c 6c 6f 63 61 74 65 20  Cannot allocate 
   0010:  6d 65 6d 6f 72 79 0a                             memory.
 23578 ktrace   RET   write 23/0x17
 23578 ktrace   CALL  mprotect(0x58b08000,0x1000,0x3<PROT_READ|PROT_WRITE>)
 23578 ktrace   RET   mprotect 0
 23578 ktrace   CALL  mprotect(0x58b08000,0x1000,0x1<PROT_READ>)
 23578 ktrace   RET   mprotect 0
 23578 ktrace   CALL  mprotect(0x58b08000,0x1000,0x3<PROT_READ|PROT_WRITE>)
 23578 ktrace   RET   mprotect 0
 23578 ktrace   CALL  mprotect(0x58b08000,0x1000,0x1<PROT_READ>)
 23578 ktrace   RET   mprotect 0
 23578 ktrace   CALL  munmap(0x58b08000,0x1000)
 23578 ktrace   RET   munmap 0
 23578 ktrace   CALL  exit(1)

$ file /usr/local/chrome/chrome
/usr/local/chrome/chrome: ELF 32-bit LSB shared object, Intel 80386, version 1

$ ls -l /usr/local/chrome/chrome
-rwxr-xr-x  1 root  bin  179649140 Oct  2 12:45 /usr/local/chrome/chrome

It looks like execve simply refuses to execute that file but I cannot find
which limit is being hit.  The next biggest executable I can find on my
system is /usr/bin/cc which is 62177052 bytes on the hard disk, and I have
no problem executing it.

This is using OpenBSD 6.8-release (with syspatches applied; dmesg below).
I just upgraded from 6.7-release which is when I found out about this
problem with chrome.  On 6.7 I had datasize-max, datasize-cur, and
memoryuse set to 1024M in /etc/login.conf and never had any problem using
chrome.

Any idea what the problem might be?

Best,

Philippe


OpenBSD 6.8 (GENERIC) #4: Mon Jan 11 10:34:49 MST 2021
    r...@syspatch-68-i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
real mem  = 1063600128 (1014MB)
avail mem = 1027911680 (980MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 05/29/07, BIOS32 rev. 0 @ 0xfd740, SMBIOS rev. 2.33 @ 
0xe0010 (64 entries)
bios0: vendor IBM version "70ET69WW (1.29 )" date 05/29/2007
bios0: IBM 1875E5U
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT TCPA APIC MCFG BOOT
acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) EXP0(S4) EXP1(S4) EXP2(S4) 
EXP3(S4) PCI1(S4) USB0(S3) USB1(S3) USB3(S3) USB7(S3) AC9M(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Pentium(R) M processor 1.60GHz ("GenuineIntel" 686-class) 1.60 
GHz, 06-0d-08
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,TM,PBE,EST,TM2,NXE,PERF,MELTDOWN
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 133MHz
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins, remapped
acpimcfg0 at acpi0
acpimcfg0: addr 0xe0000000, bus 0-255
acpimcfg0: addr 0x0, bus 0-0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (EXP0)
acpiprt2 at acpi0: bus -1 (EXP1)
acpiprt3 at acpi0: bus 3 (EXP2)
acpiprt4 at acpi0: bus -1 (EXP3)
acpiprt5 at acpi0: bus 4 (PCI1)
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
"PNP0A08" at acpi0 not configured
acpicmos0 at acpi0
"IBM0071" at acpi0 not configured
"NSC1100" at acpi0 not configured
acpibat0 at acpi0: BAT0 model "IBM-92P1091" serial  1313 type LION oem 
"Panasonic"
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0: version 1.0
acpicpu0 at acpi0: C1 (unknown FFH class 0): !C3(250@85 io@0x1015), !C2(500@1 
io@0x1014), C1(@1 halt!), PSS
acpipwrres0 at acpi0: PUBS, resource for USB0, USB1, USB7
acpitz0 at acpi0: critical temperature is 99 degC
acpidock0 at acpi0: DOCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc0000/0xf600! 0xcf800/0x1600 0xd1000/0x1000 0xdc000/0x4000! 
0xe0000/0x10000
cpu0: Enhanced SpeedStep 1597 MHz: speeds: 1600, 1333, 1066, 800 MHz
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82915GM Host" rev 0x03
inteldrm0 at pci0 dev 2 function 0 "Intel 82915GM Video" rev 0x03
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xb0000000, size 0x10000000
inteldrm0: apic 1 int 16, I915GM, gen 3
"Intel 82915GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
ppb0 at pci0 dev 28 function 0 "Intel 82801FB PCIE" rev 0x03: apic 1 int 20
pci1 at ppb0 bus 2
bge0 at pci1 dev 0 function 0 "Broadcom BCM5751M" rev 0x11, BCM5750 B1 
(0x4101): apic 1 int 16, address 00:10:c6:e1:f8:03
brgphy0 at bge0 phy 1: BCM5750 10/100/1000baseT PHY, rev. 0
ppb1 at pci0 dev 28 function 2 "Intel 82801FB PCIE" rev 0x03: apic 1 int 22
pci2 at ppb1 bus 3
uhci0 at pci0 dev 29 function 0 "Intel 82801FB USB" rev 0x03: apic 1 int 16
uhci1 at pci0 dev 29 function 1 "Intel 82801FB USB" rev 0x03: apic 1 int 17
uhci2 at pci0 dev 29 function 2 "Intel 82801FB USB" rev 0x03: apic 1 int 18
uhci3 at pci0 dev 29 function 3 "Intel 82801FB USB" rev 0x03: apic 1 int 19
ehci0 at pci0 dev 29 function 7 "Intel 82801FB USB" rev 0x03: apic 1 int 19
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 
addr 1
ppb2 at pci0 dev 30 function 0 "Intel 82801BAM Hub-to-PCI" rev 0xd3
pci3 at ppb2 bus 4
cbb0 at pci3 dev 0 function 0 "TI PCI1510 CardBus" rev 0x00: apic 1 int 16
ath0 at pci3 dev 2 function 0 "Atheros AR5212" rev 0x01: apic 1 int 21
ath0: AR5213A 5.9 phy 4.3 rf5112a 3.6 eeprom 4.8, WOR01W, address 
00:14:a4:72:72:c6
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 5 device 0 cacheline 0x8, lattimer 0xb0
pcmcia0 at cardslot0
auich0 at pci0 dev 30 function 2 "Intel 82801FB AC97" rev 0x03: apic 1 int 22, 
ICH6
ac97: codec id 0x41445374 (Analog Devices AD1981B)
ac97: codec features headphone, 20 bit DAC, No 3D Stereo
audio0 at auich0
"Intel 82801FB Modem" rev 0x03 at pci0 dev 30 function 3 not configured
ichpcib0 at pci0 dev 31 function 0 "Intel 82801FBM LPC" rev 0x03: PM disabled
pciide0 at pci0 dev 31 function 2 "Intel 82801FBM SATA" rev 0x03: DMA, channel 
0 wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <HTS541060G9AT00>
wd0: 16-sector PIO, LBA, 57231MB, 117210240 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5
atapiscsi0 at pciide0 channel 1 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <MATSHITA, UJDA765 DVD/CDRW, 1.02> removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
ichiic0 at pci0 dev 31 function 3 "Intel 82801FB SMBus" rev 0x03: apic 1 int 23
iic0 at ichiic0
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
usb4 at uhci3: USB revision 1.0
uhub4 at usb4 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 
addr 1
isa0 at ichpcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
wsmouse1 at pms0 mux 0
pms0: Synaptics touchpad, firmware 5.9, 0x2c6ab1 0x0 0x0 0x884793 0x0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt2 at isa0 port 0x3bc/4: polled
aps0 at isa0 port 0x1600/31
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
ugen0 at uhub3 port 2 "STMicroelectronics Biometric Coprocessor" rev 1.00/0.01 
addr 2
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
sd0 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006>
sd0: 57231MB, 512 bytes/sector, 117209648 sectors
softraid0: volume sd0 is roaming, it used to be sd1, updating metadata
root on sd0a (1b901368c9f9e170.a) swap on sd0b dump on sd0b
inteldrm0: 1024x768, 32bpp
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (std, vt100 emulation)

Reply via email to