🌐 AI搜索 & 代理 主页
Skip to content

syscall: on linux 386 doesn't support syscalls that don't fail #22924

@chipaca

Description

@chipaca

What version of Go are you using (go version)?

1.6.2 and 1.9.2

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux/386 and linux/arm.

What did you do?

with this built as hightest,

package main

import (
	"fmt"
	"syscall"
)

func main() {
	r0, _, e := syscall.RawSyscall(syscall.SYS_GETUID32, 0, 0, 0)
	fmt.Println(uint32(r0), "/", e)
}

and a user with a high uid,

sudo useradd --uid "$(( 0xfffffffe ))" --shell /bin/sh hightest

(alternatively if you can't useradd, use chown to a numerical id, and chmod u+s, and change the code to use GETEUID instead of GETUID)

compare the output of sudo -u hightest id -u and sudo -u hightest hightest.

What did you expect to see?

4294967294 / errno 0

What did you see instead?

4294967295 / no such file or directory

The problem seems to be that in syscall/asm_linux_386.s, if the returned value is not less than 0xfffff001 it's treated as an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions