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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1307391174.2642.8.camel@edumazet-laptop>
Date:	Mon, 06 Jun 2011 22:12:54 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	netdev <netdev@...r.kernel.org>
Subject: Re: [RFC] should we care of COMPAT mode in bridge ?

Le lundi 06 juin 2011 à 22:06 +0200, Arnd Bergmann a écrit :
> On Monday 06 June 2011 21:45:40 Eric Dumazet wrote:
> > While trying Alexander Holler patch, I found a 32bit brctl program was
> > not able to work on a 64bit kernel. So I had to switch to another
> > machine for my tests.
> > 
> > brctl addbr mybridge
> > ->
> > socket(PF_FILE, SOCK_STREAM, 0)         = 3
> > ioctl(3, SIOCSIFBR, 0xffd509c0)         = -1 EINVAL (Invalid argument)
> > 
> > Should we care or not ?
> > 
> 
> Generally, we try to make all ioctls work in compat mode. For the old
> bridge ioctls, this is currently impossible because it uses SIOCPRIVATE
> ioctls, but it would be easy to add an ndo_do_compat_ioctl. 
> 
> The solution that is documented in net/socket.c is to return 
> an invalid version number for BRCTL_VERSION, in the hope that
> brctl would switch to the newer interfaces. The new style bridge
> ioctls (SIOCBRADDBR, SIOCBRADDIF, ...) are actually supposed to work,
> but I've never tried that.
> 


I see... problem is brctl does :

int br_add_bridge(const char *brname)
{
        int ret;

#ifdef SIOCBRADDBR
        ret = ioctl(br_socket_fd, SIOCBRADDBR, brname);
        if (ret < 0)
#endif
        {
                char _br[IFNAMSIZ];
                unsigned long arg[3]
                        = { BRCTL_ADD_BRIDGE, (unsigned long) _br };

                strncpy(_br, brname, IFNAMSIZ);
                ret = ioctl(br_socket_fd, SIOCSIFBR, arg);
        }

        return ret < 0 ? errno : 0;
}


So for an old binary, compiled at the time SIOCBRADDBR wasnt there (in
include file I mean), we ended doing :

        {
                char _br[IFNAMSIZ];
                unsigned long arg[3]
                        = { BRCTL_ADD_BRIDGE, (unsigned long) _br };

                strncpy(_br, brname, IFNAMSIZ);
                ret = ioctl(br_socket_fd, SIOCSIFBR, arg);
        }

And this breaks on 64bit kernel

I guess we shall add some logic in kernel to support SIOCSIFBR
afterall ;)

Thanks !

BTW: I confirm that compiling an up2date 32bit brctl with an up2date
include files is OK on 64bit kernel.



--
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