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]
Date:	Mon, 13 Jun 2016 10:18:30 -0400
From:	Paul Moore <pmoore@...hat.com>
To:	netdev@...r.kernel.org, linux-security-module@...r.kernel.org,
	selinux@...ho.nsa.gov
Subject: Re: [PATCH] netlabel: handle sparse category maps in netlbl_catmap_getlong()

On Mon, Jun 13, 2016 at 10:16 AM, Paul Moore <pmoore@...hat.com> wrote:
> From: Paul Moore <paul@...l-moore.com>
>
> In cases where the category bitmap is sparse enough that gaps exist
> between netlbl_lsm_catmap structs, callers to netlbl_catmap_getlong()
> could find themselves prematurely ending their search through the
> category bitmap.  Further, the methods used to calculate the 'idx'
> and 'off' values were incorrect for bitmaps this large.  This patch
> changes the netlbl_catmap_getlong() behavior so that it always skips
> over gaps and calculates the index and offset values correctly.
>
> Signed-off-by: Paul Moore <paul@...l-moore.com>
> ---
>  net/netlabel/netlabel_kapi.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Another relatively small fix that I've merged into selinux#next, if
anyone has any objections, let me know.

> diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
> index bd007a9..3c070f2 100644
> --- a/net/netlabel/netlabel_kapi.c
> +++ b/net/netlabel/netlabel_kapi.c
> @@ -609,20 +609,19 @@ int netlbl_catmap_getlong(struct netlbl_lsm_catmap *catmap,
>                 off = catmap->startbit;
>                 *offset = off;
>         }
> -       iter = _netlbl_catmap_getnode(&catmap, off, _CM_F_NONE, 0);
> +       iter = _netlbl_catmap_getnode(&catmap, off, _CM_F_WALK, 0);
>         if (iter == NULL) {
>                 *offset = (u32)-1;
>                 return 0;
>         }
>
>         if (off < iter->startbit) {
> -               off = iter->startbit;
> -               *offset = off;
> +               *offset = iter->startbit;
> +               off = 0;
>         } else
>                 off -= iter->startbit;
> -
>         idx = off / NETLBL_CATMAP_MAPSIZE;
> -       *bitmap = iter->bitmap[idx] >> (off % NETLBL_CATMAP_SIZE);
> +       *bitmap = iter->bitmap[idx] >> (off % NETLBL_CATMAP_MAPSIZE);
>
>         return 0;
>  }
>



-- 
paul moore
security @ redhat

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ