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

Add Linux personality support #1012

Merged
merged 1 commit into from
Dec 17, 2019

Conversation

justincormack
Copy link
Contributor

A lot of people use the Linux personality support to allow a 64 bit machine
to emulate a 32 bit machine. In particular if you just run 32 bit binaries, many
build processes will fail as uname will still return a value appropriate for
a 64 bit system. Including the personality syscall wil change this to reflect the
value from a 32 bit system, such as i686 rather than x86_64.

Note that this patch only supports the base 32 bit/64 bit calls. The other options
are largely obsolete and rarely used. I left flexibility to add other base domains
and to add flags in future, but I am not sure there is any demand for them. The
only use case I found in the recent past was the ADDR_NO_RANDOMIZE option that
disables ASLR, which older versions of Emacs required, but generally they set this
themselves, so it is not needed as a Runc option, and it is a serious security
reduction. The 32 bit option is different as if you are running 32 bit containers
for build, they generally do not know they are "supposed" to run 32 bit, and so
this option allows you do do the equivalent of running a chroot with linux32
as is often done on non containerised build systems.

Signed-off-by: Justin Cormack justin.cormack@docker.com

@justincormack
Copy link
Contributor Author

cc @mattspencer-arm

A lot of people use the Linux `personality` support to allow a 64 bit machine
to emulate a 32 bit machine. In particular if you just run 32 bit binaries, many
build processes will fail as `uname` will still return a value appropriate for
a 64 bit system. Including the personality syscall wil change this to reflect the
value from a 32 bit system, such as `i686` rather than `x86_64`.

Note that this patch only supports the base 32 bit/64 bit calls. The other options
are largely obsolete and rarely used. I left flexibility to add other base domains
and to add flags in future, but I am not sure there is any demand for them. The
only use case I found in the recent past was the `ADDR_NO_RANDOMIZE` option that
disables ASLR, which older versions of Emacs required, but generally they set this
themselves, so it is not needed as a Runc option, and it is a serious security
reduction. The 32 bit option is different as if you are running 32 bit containers
for build, they generally do not know they are "supposed" to run 32 bit, and so
this option allows you do do the equivalent of running a `chroot` with `linux32`
as is often done on non containerised build systems.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
@mattspencer-arm
Copy link

hey @justincormack , I have reviewed this with the internal team here and we agree this should be the correct solution to the problem. Thanks for pulling this together.

@crosbymichael
Copy link
Member

crosbymichael commented Sep 18, 2019

LGTM

Approved with PullApprove

@vbatts
Copy link
Member

vbatts commented Dec 17, 2019

LGTM

As this introduces an OPTIONAL struct it is forward compatible.

Approved with PullApprove

@vbatts vbatts merged commit 68f17f5 into opencontainers:master Dec 17, 2019
@giuseppe
Copy link
Member

the schema file is not updated

@vbatts
Copy link
Member

vbatts commented Dec 17, 2019 via email

@giuseppe
Copy link
Member

opened here: #1023

@giuseppe
Copy link
Member

and a PR: #1024

@vbatts
Copy link
Member

vbatts commented Dec 17, 2019 via email

@justincormack justincormack deleted the personality branch December 18, 2019 11:03
@vbatts vbatts mentioned this pull request Jan 9, 2020
m5p3nc3r referenced this pull request in doanac/docker-ce Jan 29, 2020
containerd/containerd#3990

The problem: You run an armv8 server (such as an AWS Gravitron) and then
set up a 32-bit armhf LXC container to run Docker inside of. When
DOCKER_BUILDKIT=1 builds are performed they will pick up the OS/Arch
properly but hit /proc/cpuinfo for the Variant. It results in something
like: linux/arm/v8 which isn't even something you can use. This change
allows us to override the logic with something like GOARCH_VARIANT=v7 so
that it will work properly.

Signed-off-by: Andy Doan <andy@foundries.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants