go-delve/delve · error

malformed /proc/pid/maps on line %d: %q (permissions column

Error message

malformed /proc/pid/maps on line %d: %q (permissions column too short)

What it means

The permissions column (fields[1]) of the maps line is shorter than the mandatory 4 characters ('rwxp' style: r/w/x plus shared/private flag). A shorter permissions string cannot encode the mapping's protection, so MemoryMap fails.

Source

Thrown at pkg/proc/native/dump_linux.go:106

	v := strings.Split(fields[0], "-")
	if len(v) != 2 {
		err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (bad first field)", lineno, in)
		return
	}
	start, err = strconv.ParseUint(v[0], 16, 64)
	if err != nil {
		err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (%v)", lineno, in, err)
		return
	}
	end, err = strconv.ParseUint(v[1], 16, 64)
	if err != nil {
		err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (%v)", lineno, in, err)
		return
	}

	perm = fields[1]
	if len(perm) < 4 {
		err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (permissions column too short)", lineno, in)
		return
	}

	offset, err = strconv.ParseUint(fields[2], 16, 64)
	if err != nil {
		err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (%v)", lineno, in, err)
		return
	}

	dev = fields[3]

	// fields[4] -> inode

	filename = strings.TrimLeft(fields[5], " ")
	return

}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Check the raw line: the perms column must be 4 chars (e.g. 'r-xp'); if the source file is hand-made, fix it to include the 4th character.
  2. Test whether the sandbox (gVisor, LXC) alters /proc/pid/maps and run outside it if so.
  3. Retry the read — transient truncation produces short fields.
  4. If integrating with a custom procfs, make it emit kernel-compatible permission strings.

Example fix

// before: hand-crafted maps line for tests
"00400000-00401000 r-x  00000000 08:01 1234  /bin/app"
// after
"00400000-00401000 r-xp 00000000 08:01 1234  /bin/app"
Defensive patterns

Strategy: validation

Validate before calling

perms := strings.Fields(line)[1]
if len(perms) < 4 { return fmt.Errorf("perms column too short in %q", line) }
for _, c := range perms[:4] { if !strings.ContainsRune("rwxps-", c) { return fmt.Errorf("bad perm char %q", c) } }

Type guard

func validPerms(s string) bool { return len(s) >= 4 && strings.Trim(s[:4], "rwxps-") == "" }

Try / catch

if err != nil && strings.Contains(err.Error(), "permissions column too short") {
    // detect sandbox-altered procfs and warn the user
    return fmt.Errorf("%w (sandboxed procfs suspected)", err)
}

Prevention

When it happens

Trigger: parseSmapsHeaderLine receiving a maps line like '00400000-00401000 rw' — a truncated or hand-modified permissions column, or a non-Linux procfs emulation emitting 3-char permission strings.

Common situations: Custom seccomp/gVisor/FUSE procfs implementations that trim the private/shared flag; corrupted line from a race; hand-crafted test maps files missing the 4th perm char.

Understand the failure class

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/f96894973eb97d19. Report an issue: GitHub.