From: Tobias Brunner Date: Fri, 16 Feb 2024 13:04:45 +0000 (+0100) Subject: Merge branch 'ref-overflows' X-Git-Tag: android-2.5.0~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b940ce25e9eb4d34e9e28dd44c85f1a9f62bafb8;p=thirdparty%2Fstrongswan.git Merge branch 'ref-overflows' Different users in the strongSwan code base use the refcount helpers to allocate incrementing unique values. So far the risk of overflows for these unsigned 32-bit values has been considered mostly theoretical, as it requires a longer uptime and a lot of activity to hit such an overflow. At least for the Netlink sequence numbers, this is not only theoretical, though, and an overflow has been hit on a productive setup. Unfortunately, the consequences are rather unpleasant, as the response with a zero sequence number can't be matched to the request. This results in the offending thread to block indefinitely while holding the Netlink mutex. So add a helper to allocate incrementing unique identifiers that checks for overflows and never returns 0. Use it for Netlink sequence numbers and some other potential users affected, namely those allocating IKE_SA/CHILD_SA unique identifiers, marks and interface identifiers. Closes strongswan/strongswan#2062 --- b940ce25e9eb4d34e9e28dd44c85f1a9f62bafb8