Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
Cannot mmap after switching to 64 bit mode in a Linux user-space process that started as 32-bit

I tried to do an mmap syscall after switching to 64 bit mode on x86 Linux (Linux version 5.15.6), but the syscall returns ENOMEM. A minimal reproducible example is given by the following assembly code:

.text
.global _start

_start:
.code32

jmp $0x33, $start64 // jmp to start64 and change mode to 64 bit

.code64
start64:

mov $9, %rax // mmap
mov $0, %rdi // NULL
mov $0x1000, %rsi // size
mov $1, %rdx // PROT_READ
mov $0x22, %r10
mov $0, %r8
mov $0, %r9
syscall

mov $60, %rax // 64 bit style exit
mov $0, %rdi
syscall

The corresponding output of strace is:

execve("./mmap_test32", ["./mmap_test32"], 0x7ffe0ccd7920 /* 60 vars */) = 0
mmap(NULL, 4096, PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = -1 ENOMEM (Cannot allocate memory)
exit(0)                                 = ?
+++ exited with 0 +++

Does anyone have an idea why this is not working?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda