syscall: Getpagesize should consult OS on arm64 #13191

Closed
hrw opened this Issue Nov 9, 2015 · 4 comments

Comments

Projects
None yet
7 participants

hrw commented Nov 9, 2015

There is code in src/syscall/syscall_linux_arm64.go file:

func Getpagesize() int { return 65536 }

But this architecture supports three values for PAGE_SIZE: 4K, 16K and 64K which are selected at kernel compilation time.

Userspace is expected to check which value is set. Simplest solution is to use sysconf(_SC_PAGESIZE) function call (same as getpagesize()).

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Nov 9, 2015

@rakyll rakyll changed the title from On AArch64 Getpagesize() can return wrong value to syscall: on aarch64 Getpagesize() can return wrong value Nov 9, 2015

@rsc rsc changed the title from syscall: on aarch64 Getpagesize() can return wrong value to syscall: Getpagesize should consult OS on arm64 Nov 24, 2015

@rsc rsc modified the milestones: Unplanned, Go1.6 Dec 5, 2015

This is causing an issue in Docker running on arm64 with the new overlay driver. We use the pagesize to determine when we the mount arguments are too large. It would be preferable to report the PageSize as the minimum value rather than the maximum to avoid unexpected truncation to syscalls.

See https://github.com/docker/docker/blob/3b0660da30a23b86a2f29f1ecf3ded52ab7fe577/daemon/graphdriver/overlay2/overlay.go#L476

Thanks @dmcgowan - good catch!

vielmetti commented Oct 19, 2016

This commit 1b9499b
looks like it addresses this problem, with the other related issue at #10180

Owner

bradfitz commented Oct 19, 2016

Oh, yeah, @aclements already did this in 1b9499b

@bradfitz bradfitz closed this Oct 19, 2016

@gopherbot gopherbot locked and limited conversation to collaborators Oct 19, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.