Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.
@ 2014-12-23 10:44 Nicolas Cavallari
  2014-12-23 11:20 ` Thomas Petazzoni
  2014-12-26 20:02 ` Thomas Petazzoni
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Cavallari @ 2014-12-23 10:44 UTC (permalink / raw)
  To: buildroot

nsenter is a tool to enter the namespace of another process.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
---
 package/util-linux/Config.in     | 5 +++++
 package/util-linux/util-linux.mk | 1 +
 2 files changed, 6 insertions(+)

diff --git a/package/util-linux/Config.in b/package/util-linux/Config.in
index 5dfd050..2f23419 100644
--- a/package/util-linux/Config.in
+++ b/package/util-linux/Config.in
@@ -118,6 +118,11 @@ config BR2_PACKAGE_UTIL_LINUX_MESG
 	help
 	  Control write access to your terminal
 
+config BR2_PACKAGE_UTIL_LINUX_NSENTER
+	bool "nsenter"
+	help
+	  Enter the namespaces of another process.
+
 config BR2_PACKAGE_UTIL_LINUX_MOUNT
 	bool "mount/umount"
 	help
diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
index e06fa9a..a530596 100644
--- a/package/util-linux/util-linux.mk
+++ b/package/util-linux/util-linux.mk
@@ -74,6 +74,7 @@ UTIL_LINUX_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LOGIN_UTILS),--enable-last --enable-login --enable-su --enable-sulogin,--disable-last --disable-login --disable-su --disable-sulogin) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_LOSETUP),--enable-losetup,--disable-losetup) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_MESG),--enable-mesg,--disable-mesg) \
+	$(if $(BR2_PACKAGE_UTIL_LINUX_NSENTER),--enable-nsenter,--disable-nsenter) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_MOUNT),--enable-mount,--disable-mount) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_NEWGRP),--enable-newgrp,--disable-newgrp) \
 	$(if $(BR2_PACKAGE_UTIL_LINUX_PARTX),--enable-partx,--disable-partx) \
-- 
2.1.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.
  2014-12-23 10:44 [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary Nicolas Cavallari
@ 2014-12-23 11:20 ` Thomas Petazzoni
  2014-12-23 12:33   ` Nicolas Cavallari
  2014-12-26 20:02 ` Thomas Petazzoni
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2014-12-23 11:20 UTC (permalink / raw)
  To: buildroot

Dear Nicolas Cavallari,

On Tue, 23 Dec 2014 11:44:10 +0100, Nicolas Cavallari wrote:
> nsenter is a tool to enter the namespace of another process.
> 
> Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
> ---
>  package/util-linux/Config.in     | 5 +++++
>  package/util-linux/util-linux.mk | 1 +
>  2 files changed, 6 insertions(+)

We had this option in the past, but it was causing some problems with a
number of toolchains, so we had to revert it. See:

  http://git.buildroot.net/buildroot/commit/package/util-linux?id=d293e64bfb75c4cbaab7e46472de674ee813d4aa

Has this issue been resolved?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.
  2014-12-23 11:20 ` Thomas Petazzoni
@ 2014-12-23 12:33   ` Nicolas Cavallari
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Cavallari @ 2014-12-23 12:33 UTC (permalink / raw)
  To: buildroot

On 23/12/2014 12:20, Thomas Petazzoni wrote:
> Dear Nicolas Cavallari,
> 
> We had this option in the past, but it was causing some problems with a
> number of toolchains, so we had to revert it. See:
> 
>   http://git.buildroot.net/buildroot/commit/package/util-linux?id=d293e64bfb75c4cbaab7e46472de674ee813d4aa

I didn't know. It was compiling fine with uclibc. Now I realize that
uclibc does not provide setns()...

> Has this issue been resolved?

Yes, there is a fallback in util-linux sources:

# if !defined(HAVE_SETNS) && defined(SYS_setns)
static inline int setns(int fd, int nstype)
{
        return syscall(SYS_setns, fd, nstype);
}
# endif

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.
  2014-12-23 10:44 [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary Nicolas Cavallari
  2014-12-23 11:20 ` Thomas Petazzoni
@ 2014-12-26 20:02 ` Thomas Petazzoni
  2014-12-26 20:45   ` Nicolas Cavallari
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2014-12-26 20:02 UTC (permalink / raw)
  To: buildroot

Dear Nicolas Cavallari,

On Tue, 23 Dec 2014 11:44:10 +0100, Nicolas Cavallari wrote:
> nsenter is a tool to enter the namespace of another process.
> 
> Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
> ---
>  package/util-linux/Config.in     | 5 +++++
>  package/util-linux/util-linux.mk | 1 +
>  2 files changed, 6 insertions(+)

Thanks, applied after adding a Config.in condition to make sure that we
don't enable this option if we have kernel headers older than 3.0: the
setns() system call was added in Linux 3.0.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.
  2014-12-26 20:02 ` Thomas Petazzoni
@ 2014-12-26 20:45   ` Nicolas Cavallari
  2014-12-26 20:57     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Cavallari @ 2014-12-26 20:45 UTC (permalink / raw)
  To: buildroot

On 26/12/2014 21:02, Thomas Petazzoni wrote:
> Dear Nicolas Cavallari,
> 
> On Tue, 23 Dec 2014 11:44:10 +0100, Nicolas Cavallari wrote:
>> nsenter is a tool to enter the namespace of another process.
>>
>> Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
>> ---
>>  package/util-linux/Config.in     | 5 +++++
>>  package/util-linux/util-linux.mk | 1 +
>>  2 files changed, 6 insertions(+)
> 
> Thanks, applied after adding a Config.in condition to make sure that we
> don't enable this option if we have kernel headers older than 3.0: the
> setns() system call was added in Linux 3.0.

I'm not so sure now ... The fallback uses SYS_netns, instead of the
kernel's __NR_setns, so i assume that there must be some C library
support ... uclibc does define SYS_netns to be __NR_setns, so i think
the problem is still valid if the toolchain does not define SYS_setns.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary.
  2014-12-26 20:45   ` Nicolas Cavallari
@ 2014-12-26 20:57     ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-12-26 20:57 UTC (permalink / raw)
  To: buildroot

Dear Nicolas Cavallari,

On Fri, 26 Dec 2014 21:45:42 +0100, Nicolas Cavallari wrote:

> I'm not so sure now ... The fallback uses SYS_netns, instead of the
> kernel's __NR_setns, so i assume that there must be some C library
> support ... uclibc does define SYS_netns to be __NR_setns, so i think
> the problem is still valid if the toolchain does not define SYS_setns.

I was also confused by this, but it's actually util-linux itself that
defines SYS_setns from __NR_setns.

From m4/ul.m4 in util-linux sources:

AC_DEFUN([UL_CHECK_SYSCALL], [
  dnl This macro uses host_cpu.
  AC_REQUIRE([AC_CANONICAL_HOST])
  AC_CACHE_CHECK([for syscall $1],
    [ul_cv_syscall_$1],
    [_UL_SYSCALL_CHECK_DECL([SYS_$1],
      [syscall=SYS_$1],
      [dnl Our libc failed use, so see if we can get the kernel
      dnl headers to play ball ...
      _UL_SYSCALL_CHECK_DECL([_NR_$1],
        [syscall=_NR_$1],
        [
          syscall=no
          if test "x$linux_os" = xyes; then
            case $host_cpu in
              _UL_CHECK_SYSCALL_FALLBACK(m4_shift($@))
            esac
          fi
        ])
      ])
    ul_cv_syscall_$1=$syscall
    ])
  AM_CONDITIONAL([HAVE_]m4_toupper($1), [test "x$ul_cv_syscall_$1" != xno])
  case $ul_cv_syscall_$1 in #(
  no) AC_MSG_WARN([Unable to detect syscall $1.]) ;;
  SYS_*) ;;
  *) AC_DEFINE_UNQUOTED([SYS_$1], [$ul_cv_syscall_$1],
        [Fallback syscall number for $1]) ;;
  esac
])

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-26 20:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-23 10:44 [Buildroot] [PATCH 1/1] util-linux: Add an option to compile 'nsenter' binary Nicolas Cavallari
2014-12-23 11:20 ` Thomas Petazzoni
2014-12-23 12:33   ` Nicolas Cavallari
2014-12-26 20:02 ` Thomas Petazzoni
2014-12-26 20:45   ` Nicolas Cavallari
2014-12-26 20:57     ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox