lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEik5nNiHdL8c9kBTNF41YBNut=L=F4Vv_QdYT3KzAh04nfe5A@mail.gmail.com>
Date:	Fri, 15 Jul 2011 19:02:00 -0500
From:	Dan McGee <dan@...hlinux.org>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] Rename static setns() function

On Fri, Jul 15, 2011 at 6:41 PM, Eric W. Biederman
<ebiederm@...ssion.com> wrote:
>
> Dan can you try this patch I think it does a better job at dealing
> with libc defining setns but I don't have a brand new libc handy
> to test with.

Works perfectly (as long as one remembers to rerun ./configure first).
It also works fine with my other configure patch I sent to the list.

-Dan

> From: "Eric W. Biederman" <ebiederm@...ssion.com>
> Date: Fri, 15 Jul 2011 16:36:33 -0700
> Subject: [PATCH] iproute2: Auto-detect the presence of setns in libc
>
> If libc has setns present use that version instead of
> rolling the syscall wrapper by hand.
>
> Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
> ---
>  configure    |   24 ++++++++++++++++++++++++
>  ip/Makefile  |    6 ++++++
>  ip/ipnetns.c |    2 ++
>  3 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index 69797ab..cfcc82a 100755
> --- a/configure
> +++ b/configure
> @@ -163,6 +163,27 @@ check_ipt_lib_dir()
>        echo "not found!"
>  }
>
> +check_setns()
> +{
> +cat >/tmp/setnstest.c <<EOF
> +#include <sched.h>
> +int main(int argc, char **argv)
> +{
> +       (void)setns(0,0);
> +       return 0;
> +}
> +EOF
> +gcc -I$INCLUDE -o /tmp/setnstest /tmp/setnstest.c >/dev/null 2>&1
> +if [ $? -eq 0 ]
> +then
> +       echo "IP_CONFIG_SETNS:=y" >>Config
> +       echo "yes"
> +else
> +       echo "no"
> +fi
> +rm -f /tmp/setnstest.c /tmp/setnstest
> +}
> +
>  echo "# Generated config based on" $INCLUDE >Config
>
>  echo "TC schedulers"
> @@ -178,3 +199,6 @@ check_ipt
>
>  echo -n "iptables modules directory: "
>  check_ipt_lib_dir
> +
> +echo -n "libc has setns: "
> +check_setns
> diff --git a/ip/Makefile b/ip/Makefile
> index 2ee4e7c..8d03993 100644
> --- a/ip/Makefile
> +++ b/ip/Makefile
> @@ -7,6 +7,12 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
>
>  RTMONOBJ=rtmon.o
>
> +include ../Config
> +
> +ifeq ($(IP_CONFIG_SETNS),y)
> +       CFLAGS += -DHAVE_SETNS
> +endif
> +
>  ALLOBJ=$(IPOBJ) $(RTMONOBJ)
>  SCRIPTS=ifcfg rtpr routel routef
>  TARGETS=ip rtmon
> diff --git a/ip/ipnetns.c b/ip/ipnetns.c
> index db7007c..dff3497 100644
> --- a/ip/ipnetns.c
> +++ b/ip/ipnetns.c
> @@ -28,6 +28,7 @@
>  #define MNT_DETACH     0x00000002      /* Just detach from the tree */
>  #endif /* MNT_DETACH */
>
> +#ifndef HAVE_SETNS
>  static int setns(int fd, int nstype)
>  {
>  #ifdef __NR_setns
> @@ -37,6 +38,7 @@ static int setns(int fd, int nstype)
>        return -1;
>  #endif
>  }
> +#endif /* HAVE_SETNS */
>
>
>  static int touch(const char *path, mode_t mode)
> --
> 1.7.5.1.217.g4e3aa
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ