public inbox for kernel-hardening@lists.openwall.com
 help / color / mirror / Atom feed
From: Solar Designer <solar@openwall.com>
To: kernel-hardening@lists.openwall.com
Subject: Re: [kernel-hardening] 32/64 bitness restriction for pid namespace
Date: Tue, 16 Aug 2011 01:46:51 +0400	[thread overview]
Message-ID: <20110815214651.GC20895@openwall.com> (raw)
In-Reply-To: <20110815153836.GA6060@albatros>

Vasiliy,

On Mon, Aug 15, 2011 at 07:38:36PM +0400, Vasiliy Kulikov wrote:
> Note the strage output of -e32 lock64, -e64 lock32, lock64 -e lock32.
> There is a major problem with lock on exec (ptrace output):
> 
>     execve("./lock32", ["./lock32", "-e64", "./lock32"], [/* 17 vars */]) = 0
>     ...
>     prctl(0x23 /* PR_??? */, 0x1, 0x40, 0, 0) = 0
>     execve("./lock32", ["./lock32"], [/* 28 vars */]) = -1 ENOEXEC (Exec format error)
>     execve("/bin/sh", ["/bin/sh", "./lock32"], [/* 28 vars */]) = 0
>     brk(0)                                  = 0x2447000
>     ...
> 
> So, library function tries to run /bin/sh if no kernel interpreter is
> found.  As the first execve(2) failed, the lock on exec is not forced
> anymore, but from the application point of view it is the only execve().
> For -e lock32 the expectation is not broken, but 32bit ELF is still tried to
> be passed to 64bit /bin/sh.

That's nasty.

> My point is still that we should keep the only flag - lock current
> process and implement simple re-exec of vzctl.

It's not so simple.  It means, for example, that Owl built for x86_64
should also contain a version of vzctl built for i686 - but it normally
lacks development tools and libraries for that (we don't currently do
multilib within a single build of Owl).

> But other ways like workaround of multiple execve() calls are welcome.

Given your discovery, maybe we should have execve() return an error code
like -EPERM, such that the library would not try the shell?

Thanks,

Alexander

  parent reply	other threads:[~2011-08-15 21:46 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-07 11:00 [kernel-hardening] 32/64 bitness restriction for pid namespace Vasiliy Kulikov
2011-08-08 17:39 ` [kernel-hardening] " Vasiliy Kulikov
2011-08-10  9:52   ` Vasiliy Kulikov
2011-08-10 13:03     ` [kernel-hardening] " Solar Designer
2011-08-10 13:27       ` Vasiliy Kulikov
2011-08-10 14:26         ` Solar Designer
2011-08-10 15:02           ` Vasiliy Kulikov
2011-08-10 15:40             ` Solar Designer
2011-08-10 16:21               ` Vasiliy Kulikov
2011-08-10 16:42                 ` Solar Designer
2011-08-12 12:07                   ` Vasiliy Kulikov
2011-08-12 12:23                     ` Solar Designer
2011-08-13 15:12                       ` Vasiliy Kulikov
2011-08-13 15:19                         ` Solar Designer
2011-08-13 16:55                           ` Vasiliy Kulikov
2011-08-13 17:31                             ` Vasiliy Kulikov
2011-08-13 19:25                               ` Solar Designer
2011-08-13 19:22                             ` Solar Designer
2011-08-14  9:50                             ` Solar Designer
2011-08-14 10:16                               ` Vasiliy Kulikov
2011-08-14 11:29                                 ` Solar Designer
2011-08-14 11:55                                   ` Vasiliy Kulikov
2011-08-14 12:04                                     ` Solar Designer
2011-08-14 12:16                                       ` Vasiliy Kulikov
2011-08-15 15:38                                       ` Vasiliy Kulikov
2011-08-15 21:33                                         ` Solar Designer
2011-08-16  6:39                                           ` Vasiliy Kulikov
2011-08-15 21:46                                         ` Solar Designer [this message]
2011-08-16  6:25                                           ` Vasiliy Kulikov
2011-08-18 10:34                                         ` Solar Designer
2011-08-18 14:42                                           ` Vasiliy Kulikov
2011-08-12  9:09                 ` Vasiliy Kulikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110815214651.GC20895@openwall.com \
    --to=solar@openwall.com \
    --cc=kernel-hardening@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox