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: <20100803143442.GW11110@cel.leo>
Date:	Tue, 3 Aug 2010 15:34:42 +0100
From:	Paul LeoNerd Evans <leonerd@...nerd.org.uk>
To:	Andi Kleen <andi@...stfloor.org>, netdev@...r.kernel.org
Cc:	David Miller <davem@...emloft.net>
Subject: Re: RFC: New BGF 'LOOP' instruction

On Tue, Aug 03, 2010 at 03:11:10PM +0100, Paul LeoNerd Evans wrote:
>   switch(hdrtype)
>   {
>      case 1:
>        length = someconst; break;
>      case 2:
>        length = someotherconst; break;
>      case 3:
>        length = b[someoffset]; break;
>      ...
>   }

Of course, I completely forgot about finding also the offset of the
'next header' from the current header. That results in some code which,
in C, would look like:

  int hdrtype = b[IPv6_nexthdr];

  int x = size_of_IPv6_header;

  while(hdrtype != hdr_wanted) {
       int len;
       switch(hdrtype) {
         case 1:
           len = someconst;
           hdrtype = someotherconst;
           break;
         case 2:
           len = b[x+someoffs];
           hdrtype = b[x+someotheroffs];
           break;
         /* other IPv6 header types here */
       }

       x += len;
  }

You can't compile that idea into BPF without using a scratch memory
cell, because you can't have both 'len' and 'hdrtype' live in A at the
same time, nor can you atomically x += b[x+someoffs].

In short, much much easier if the C code did this part...

-- 
Paul "LeoNerd" Evans

leonerd@...nerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Download attachment "signature.asc" of type "application/pgp-signature" (191 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ