Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: incorrect arguments of prlimit64 syscall on linux #17606

Closed
ultimatesolution opened this issue Oct 26, 2016 · 5 comments
Closed

syscall: incorrect arguments of prlimit64 syscall on linux #17606

ultimatesolution opened this issue Oct 26, 2016 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ultimatesolution
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version devel +7124056 Mon Oct 24 19:29:18 2016 +0000 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/gopath"
GORACE=""
GOROOT="/home/user/go"
GOTOOLDIR="/home/user/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build394839699=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

I look at Go sources and see incorrect argument passing to sys_prlimit64 Linux syscall:

https://github.com/golang/go/blob/master/src/syscall/zsyscall_linux_386.go#L767

https://github.com/golang/go/blob/master/src/syscall/zsyscall_linux_amd64.go#L767

etc

    _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0)

What did you expect to see?

newlimit MUST be passed first, old must be passed next.

    _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)

see Linux kernel source tree for example:

asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
                const struct rlimit64 __user *new_rlim,
                struct rlimit64 __user *old_rlim);

What did you see instead?

see above

@rakyll rakyll changed the title Linux: syscall.prlimit: incorrect arguments of prlimit64 syscall syscall: incorrect arguments of prlimit64 syscall on linux Oct 26, 2016
@rakyll rakyll added this to the Go1.8 milestone Oct 26, 2016
@bradfitz
Copy link
Contributor

/cc @ianlancetaylor

@quentinmit quentinmit added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Nov 7, 2016
@quentinmit
Copy link
Contributor

It looks like only the names of the arguments are wrong; the calls do actually pass the right thing. Getrlimit passes nil, old and Setrlimit passes new, nil.

@bradfitz
Copy link
Contributor

bradfitz commented Nov 8, 2016

@quentinmit, ah, great. That's reassuring. Sent https://golang.org/cl/32889

@bradfitz bradfitz assigned bradfitz and unassigned ianlancetaylor Nov 8, 2016
@gopherbot
Copy link

CL https://golang.org/cl/32889 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/32912 mentions this issue.

gopherbot pushed a commit to golang/sys that referenced this issue Nov 8, 2016
Update golang/go#17606.

Change-Id: I922525561d81a8b7d805729028825953424f6ecc
Reviewed-on: https://go-review.googlesource.com/32912
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
@golang golang locked and limited conversation to collaborators Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants