Re: [PATCH net 1/2] selftests: netfilter: fix udpclash tool hang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue,  2 Sep 2025 20:58:54 +0200 Florian Westphal wrote:
> Yi Chen reports that 'udpclash' loops forever depending on compiler
> (and optimization level used); while (x == 1) gets optimized into
> for (;;).  Switch to stdatomic to prevent this.

gcc version 15.1.1 (F42) w/ whatever flags kselftests use appear to be
unaware of this macro:

udpclash.c:33:26: error: implicit declaration of function ‘ATOMIC_VAR_INIT’; did you mean ‘ATOMIC_FLAG_INIT’? [-Wimplicit-function-declaration]
   33 | static atomic_int wait = ATOMIC_VAR_INIT(1);
      |                          ^~~~~~~~~~~~~~~
      |                          ATOMIC_FLAG_INIT
udpclash.c:33:26: error: initializer element is not constant

Could you perhaps use volatile instead?

> +#include <stdatomic.h>
>  #include <stdio.h>
>  #include <string.h>
>  #include <stdlib.h>
> @@ -29,7 +30,7 @@ struct thread_args {
>  	int sockfd;
>  };
>  
> -static int wait = 1;
> +static atomic_int wait = ATOMIC_VAR_INIT(1);
>  
>  static void *thread_main(void *varg)
>  {






[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux