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: <20080506124315.4567ee73@core>
Date:	Tue, 6 May 2008 12:43:15 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Davide Libenzi <davidel@...ilserver.org>,
	Ulrich Drepper <drepper@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	netdev@...r.kernel.org, mtk.manpages@...il.com,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 02/18] flag parameters: socket and socketpair

> > > 	type = flag_remap(type, &fflags, SOCK_whatever, O_whatever);
> > > 	type = flag_remap(type, &fflags, SOCK_whatever2, O_whatever2);
> > > 
> > > ?
> > 
> > I think it is better to keep it able to remap more than one flag, with a 
> > single call, that is table driven.
> > 
> 
> The table-driven approach is slower for one and probably two bits and it is
> somewhat less readable.  What do we gain in return for this?

Acute over-engineering ?

We've got lots of space for flag bits so surely we can do remap with a
shift and mask.

	flags = (type >> SOCK_FLAG_SHIFT) & SOCK_FLAG_MASK;
	type = type & SOCK_TYPE_MASK

For most boxes

SOCK_TYPE_MASK can easily be 0xFF
SOCK_FLAG_MASK O_CLOEXEC
SOCK_FLAG_SHIFT 0

and tweaked a bit depending what other flags we want.

In Linux we could actually just do SOCK_STREAM|O_CLOEXEC but that would be
bad news for portability to other OS where the trick might well not work.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ