You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the internal stack transfer function slp_switch() is implemented using gcc/clang inline assembly, the inline assembly depends on the register allocation rules defined in the ABI-specification of the respective platform. Now if compiler inlines the function, the register allocation rules no longer apply and the behaviour is undefined.
Experiments show that the only reliable way to prevent inlining is to call slp_switch() using a volatile pointer. Here is the patch.
This has the additional advantage that slp_switch() now can be declared static, which reduces namespace pollution.
The text was updated successfully, but these errors were encountered:
Prevent inlining slp_switch() more reliably. C standard guarantees to read
the value of a volatile variable from memory on each access. Therefore
the compiler does not know the called function and can't inline.
Prevent inlining slp_switch() more reliably. C standard guarantees to read
the value of a volatile variable from memory on each access. Therefore
the compiler does not know the called function and can't inline.
(cherry picked from commit 78f6b66)
If the internal stack transfer function
slp_switch()
is implemented using gcc/clang inline assembly, the inline assembly depends on the register allocation rules defined in the ABI-specification of the respective platform. Now if compiler inlines the function, the register allocation rules no longer apply and the behaviour is undefined.Experiments show that the only reliable way to prevent inlining is to call
slp_switch()
using a volatile pointer. Here is the patch.This has the additional advantage that
slp_switch()
now can be declared static, which reduces namespace pollution.The text was updated successfully, but these errors were encountered: