boostorg / context

305 stars 150 forks source link

`__NR_map_shadow_stack` redefinition #269

Open Lastique opened 2 months ago

Lastique commented 2 months ago

When compiling Boost.Fiber on Kubuntu 24.04 (kernel version 6.8.0-44, glibc 2.39-0ubuntu8.3) I get these warnings:

In file included from ./boost/context/fiber.hpp:12,
                 from ./boost/fiber/context.hpp:28,
                 from libs/fiber/src/algo/algorithm.cpp:9:
./boost/context/fiber_fcontext.hpp:52: warning: "__NR_map_shadow_stack" redefined
   52 | #  define __NR_map_shadow_stack 451
      | 
In file included from /usr/include/x86_64-linux-gnu/asm/unistd.h:20,
                 from /usr/include/x86_64-linux-gnu/sys/syscall.h:24,
                 from /usr/include/syscall.h:1,
                 from /usr/include/c++/13/bits/atomic_wait.h:46,
                 from /usr/include/c++/13/bits/atomic_base.h:42,
                 from /usr/include/c++/13/atomic:41,
                 from ./boost/fiber/algo/algorithm.hpp:9,
                 from libs/fiber/src/algo/algorithm.cpp:7:
/usr/include/x86_64-linux-gnu/asm/unistd_64.h:368: note: this is the location of the previous definition
  368 | #define __NR_map_shadow_stack 453
      | 

I think, the code should check if __NR_map_shadow_stack is defined and use the existing define, if possible.

I should say that __NR_map_shadow_stack is defined to 453 in both unistd_64.h and unistd_32.h on my machine. I'm not sure if the value 451 is correct to begin with.