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]
Date:   Mon, 15 Jun 2020 11:56:34 +0200
From:   Tobias Brunner <tobias@...ongswan.org>
To:     Xin Long <lucien.xin@...il.com>, netdev@...r.kernel.org
Cc:     Steffen Klassert <steffen.klassert@...unet.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        Jamal Hadi Salim <hadi@...erus.ca>,
        Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCH ipsec] xfrm: policy: match with both mark and mask on user
 interfaces

Hi Xin,

> To fix this duplicated policies issue, and also fix the issue in
> commit ed17b8d377ea ("xfrm: fix a warning in xfrm_policy_insert_list"),
> when doing add/del/get/update on user interfaces, this patch is to change
> to look up a policy with both mark and mask by doing:
> 
>   mark.v == pol->mark.v && mark.m == pol->mark.m

Looks good, thanks a lot for your work on this.  All tests in our
regression test suite complete successfully with this patch applied.

Tested-by: Tobias Brunner <tobias@...ongswan.org>

> and leave the check:
> 
>   ((mark.v & mark.m) & pol->mark.m) == pol->mark.v.
> 
> for tx/rx path only.

If you are referring to the check in xfrm_policy_match() it's actually:

  (fl->flowi_mark & pol->mark.m) != pol->mark.v

Or more generically something like:

  (mark & pol->mark.m) == pol->mark.v

As we only have the mark on the packets/flow (no mask) to match against.

> -static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
> +static bool xfrm_policy_mark_match(const struct xfrm_mark *mark,
>  				   struct xfrm_policy *pol)
>  {
> -	if (policy->mark.v == pol->mark.v &&
> -	    policy->priority == pol->priority)
> -		return true;
> -
> -	return false;
> +	return mark->v == pol->mark.v && mark->m == pol->mark.m;
>  }

I guess you could make that function `static inline`.

Regards,
Tobias

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ