[CRIU] ✗ ci.openvz.org: failure for Fix UB in choose_service_fd_base due to calling __builtin_clz(0)

Radoslaw Burny rburny at google.com
Mon Apr 9 18:33:53 MSK 2018


Sorry, I somehow messed up linebreaks in the original patch. Here's the
fixed one.





From: Radoslaw Burny <rburny at google.com>

Subject: [PATCH] Fix UB in choose_service_fd_base.

Signed-off-by: Radoslaw Burny <rburny at google.com>

---
 criu/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/criu/util.c b/criu/util.c
index b19bf517..48ba09a8 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -588,9 +588,9 @@ static int choose_service_fd_base(struct pstree_item
*me)
        nr += 16; /* Safety pad */
        real_nr = nr;

-       nr /= (1024 / sizeof(void *));
+       /* Align nr to the power of 2 for easier debugging */
+       BUG_ON(nr <= 0);
        nr = 1 << (32 - __builtin_clz(nr));
-       nr *= (1024 / sizeof(void *));

        if (nr > service_fd_rlim_cur) {
                /* Right border is bigger, than rlim. OK, then just aligned
value is enough */
-- 
2.17.0.484.g0c8726318c-goog


On Mon, Apr 9, 2018 at 5:13 PM, Patchwork <criupatchwork at gmail.com> wrote:

> == Series Details ==
>
> Series: Fix UB in choose_service_fd_base due to calling __builtin_clz(0)
> URL   : https://patchwork.criu.org/series/2463/
> State : failure
>
> == Logs ==
>
> For more details see: https://ci.openvz.org/job/
> CRIU/job/criu-patchwork/1812//console
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20180409/88bd0b88/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4843 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.openvz.org/pipermail/criu/attachments/20180409/88bd0b88/attachment.p7s>


More information about the CRIU mailing list