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: <20100620215743.GA4036@nuttenaction>
Date:	Sun, 20 Jun 2010 23:57:44 +0200
From:	Hagen Paul Pfeifer <hagen@...u.net>
To:	David Miller <davem@...emloft.net>
Cc:	shemminger@...tta.com, netdev@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] net: optimize Berkeley Packet Filter (BPF) processing

* David Miller | 2010-06-20 15:09:28 [-0700]:

>I think from this perspective, the change is fine too, nothing visible
>to the user is being changed here.

Fine! I have a fundamental question: can we start to use a C language
extension, known as "Labels as Values" in the kernel? I checked this and at
least gcc, llvm and icc support this extension (btw: c1x[1] don't mention
this):

static int sk_run_filter(struct sock_filter *filter) {
  static const void *codetable[] =
      { &&BPF_S_RET_K, &&BPF_S_ALU_ADD_X, &&BPF_S_ALU_SUB_X, &&BPF_S_ALU_MUL_X };
  int pc = 0;

  goto *codetable[*(filter[pc++].code)];

  BPF_S_RET_K:
   return k;

  BPF_S_ALU_ADD_X:
   A += X;
   goto *codetable[*(filter[pc++].code)];

  BPF_S_ALU_SUB_X:
   A -= X;
   goto *codetable[*(filter[pc++].code)];

  BPF_S_ALU_MUL_X:
	 A *= X
   goto *codetable[*(filter[pc++].code)];
}


At least for gcc and llvm the results are quite impressive: http://llvm.org/bugs/show_bug.cgi?id=3120 

arch/m68k/amiga/config.c:amiga_reset() seems to be the only user in the kernel
who use this extension (and nobody complains? ;-)


Cheers, Hagen

[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1425.pdf

-- 
Hagen Paul Pfeifer <hagen@...u.net>  ||  http://blog.jauu.net/
Telephone: +49 174 5455209           ||  Key Id: 0x98350C22
Key Fingerprint: 490F 557B 6C48 6D7E 5706 2EA2 4A22 8D45 9835 0C22
--
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