Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 591392 - net-misc/openssh-7.3: sandbox seccomp fails on MIPS64/N32 due to inadequate whitelist added
Summary: net-misc/openssh-7.3: sandbox seccomp fails on MIPS64/N32 due to inadequate w...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: MIPS Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://bugzilla.mindrot.org/show_bug...
Whiteboard:
Keywords: UPSTREAM
Depends on:
Blocks:
 
Reported: 2016-08-16 13:50 UTC by Joshua Kinard
Modified: 2016-11-27 09:48 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch for openssh-7.3p1 to changes mips64/mips64el case to use N32 ABI (openssh-7.3-mips-seccomp-n32.patch,581 bytes, patch)
2016-08-19 14:34 UTC, Joshua Kinard
Details | Diff
patch to openssh-7.3_p1-r1.ebuild to apply the N32 patch (openssh-7.3_p1-r1_ebuild-mips-seccomp-n32-fix.diff,649 bytes, patch)
2016-08-19 14:37 UTC, Joshua Kinard
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Kinard gentoo-dev 2016-08-16 13:50:33 UTC
Per Upstream Buig #2509, which I reopened a little while ago, in openssh-7.3, MIPS was one of the archs that gained seccomp sandboxing support via a "whitelist" that was added to configure.ac.  From the original Red Hat bug #1195065:

+	mips-*)
+		seccomp_audit_arch=AUDIT_ARCH_MIPS
+		;;
+	mipsel-*)
+		seccomp_audit_arch=AUDIT_ARCH_MIPSEL
+		;;
+	mips64-*)
+		seccomp_audit_arch=AUDIT_ARCH_MIPS64
+		;;
+	mips64el-*)
+		seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
+		;;

The two bits for mips64-* and mips64el-* will fail on N32 userlands because those ABI's need AUDIT_ARCH_MIPS64N32 or AUDIT_ARCH_MIPSEL64N32.  Failure to use this and having "UsePrivilegeSeparation sandbox" in sshd_config will cause the child process spawned by the parent sshd process to die with a SIGSYS error.

I might have a patch for the Gentoo side later on today, but I've re-opened the upstream bug so they can figure out a way to fix it that works for them.  So this is a hybrid of a tracking/upstream bug that will soon have a Gentoo-specific fix (which will probably rely on checking the selected profile or such).

Unknown how this will affect the N64 case, let alone multilib installs.
Comment 1 Joshua Kinard gentoo-dev 2016-08-19 14:34:28 UTC
Created attachment 443768 [details, diff]
patch for openssh-7.3p1 to changes mips64/mips64el case to use N32 ABI

It's a bit of a brutish hack for the mips case until upstream implements a proper fix.
Comment 2 Joshua Kinard gentoo-dev 2016-08-19 14:37:24 UTC
Created attachment 443770 [details, diff]
patch to openssh-7.3_p1-r1.ebuild to apply the N32 patch

The N32 patch is only applied if $CHOST is "mips64*-unknown-*" and $ABI is "n32".
Comment 3 Joshua Kinard gentoo-dev 2016-08-20 13:23:19 UTC
Forgot to add the rest of the MIPS team.
Comment 4 Patrick McLean gentoo-dev 2016-09-20 01:44:16 UTC
Fixed with provided patch in openssh-7.3_p1-r5

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82d72deec8357ab399ef96e4d4eda1b64bc37f6f