Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: aligned atomics #9455

Closed
wants to merge 4 commits into from

Conversation

omoerbeek
Copy link
Member

@omoerbeek omoerbeek commented Sep 9, 2020

Short description

An approach to fix #9451

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
  • checked that this code was merged to master

@hhoffstaette
Copy link
Contributor

hhoffstaette commented Sep 9, 2020

Maybe also update the atomics in DownstreamState & ClientState to stat_t, as well as anything in dnsdist-cache.hh. Should be a simple search&replace.

@omoerbeek
Copy link
Member Author

@rgacogne if you're happy with the general direction, I'll continue with separating this class out into a .hh file so it will be easy to use in rec and auth as well.

@rgacogne
Copy link
Member

Yes, the general approach seems good to me. Perhaps we should template this, since we have mostly uint64_t counters but not exclusively?

@omoerbeek
Copy link
Member Author

BTW, I'm wondering if this is worth it for all atomic vars or only for the ones that are updated very often. OTOH, memory is cheap I'm told.

@rgacogne
Copy link
Member

UBSan is not happy, reporting alignment issues :-/:

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_tree.h:691:24: runtime error: downcast of misaligned address 0x612000000090 for type 'const _Rb_tree_node<SuffixMatchTree<DynBlock> >', which requires 64 byte alignment
33440x612000000090: note: pointer points here
3345 be be be be  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  90 00 00 00 20 61 00 00  90 00 00 00
3346              ^ 
3347    #0 0x5574ccad311a in std::_Rb_tree<SuffixMatchTree<DynBlock>, SuffixMatchTree<DynBlock>, std::_Identity<SuffixMatchTree<DynBlock> >, std::less<SuffixMatchTree<DynBlock> >, std::allocator<SuffixMatchTree<DynBlock> > >::begin() const /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_tree.h:691:24
3348    #1 0x5574cd687b01 in void SuffixMatchTree<DynBlock>::visit<connectionThread(int, ComboAddress)::$_0>(connectionThread(int, ComboAddress)::$_0 const&) const /home/travis/build/PowerDNS/pdns/pdns/dnsdistdist/dnsdist-0.0.0.0.HEAD.g5c4092cb4a.dirty/./dnsname.hh:290:23
3349    #2 0x5574cd66e078 in connectionThread(int, ComboAddress) /home/travis/build/PowerDNS/pdns/pdns/dnsdistdist/dnsdist-0.0.0.0.HEAD.g5c4092cb4a.dirty/dnsdist-web.cc:420:14
3350    #3 0x5574cc854b94 in void std::_Bind_simple<void (*(int, ComboAddress))(int, ComboAddress)>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731:18
3351    #4 0x7fe20a721a5f  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb1a5f)
3352    #5 0x7fe20a97c183 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8183)
3353    #6 0x7fe209a7cffc in clone (/lib/x86_64-linux-gnu/libc.so.6+0xfdffc)
3354
3355SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_tree.h:691:24 in 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_tree.h:691:24: runtime error: downcast of misaligned address 0x612000000090 for type 'const _Rb_tree_node<SuffixMatchTree<DynBlock> >', which requires 64 byte alignment
38820x612000000090: note: pointer points here
3883 be be be be  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  90 00 00 00 20 61 00 00  90 00 00 00
3884              ^ 
3885    #0 0x55994440b11a in std::_Rb_tree<SuffixMatchTree<DynBlock>, SuffixMatchTree<DynBlock>, std::_Identity<SuffixMatchTree<DynBlock> >, std::less<SuffixMatchTree<DynBlock> >, std::allocator<SuffixMatchTree<DynBlock> > >::begin() const /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_tree.h:691:24
3886    #1 0x559944fbfb01 in void SuffixMatchTree<DynBlock>::visit<connectionThread(int, ComboAddress)::$_0>(connectionThread(int, ComboAddress)::$_0 const&) const /home/travis/build/PowerDNS/pdns/pdns/dnsdistdist/dnsdist-0.0.0.0.HEAD.g5c4092cb4a.dirty/./dnsname.hh:290:23
3887    #2 0x559944fa6078 in connectionThread(int, ComboAddress) /home/travis/build/PowerDNS/pdns/pdns/dnsdistdist/dnsdist-0.0.0.0.HEAD.g5c4092cb4a.dirty/dnsdist-web.cc:420:14
3888    #3 0x55994418cb94 in void std::_Bind_simple<void (*(int, ComboAddress))(int, ComboAddress)>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731:18
3889    #4 0x7f2f2b947a5f  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb1a5f)
3890    #5 0x7f2f2bba2183 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8183)
3891    #6 0x7f2f2aca2ffc in clone (/lib/x86_64-linux-gnu/libc.so.6+0xfdffc)

@rgacogne
Copy link
Member

BTW, I'm wondering if this is worth it for all atomic vars or only for the ones that are updated very often. OTOH, memory is cheap I'm told.

It's probably only worth it for some very specific atomic vars, yes. I'll review the changes to make sure we are not increasing the size of a problematic struct.

storage causes unaligned access according to UBSan???, possibly
related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60734
@rgacogne
Copy link
Member

rgacogne commented Nov 2, 2020

I believe we can move this from a draft to a regular pull request now? :)

@rgacogne rgacogne added this to the dnsdist-1.6.0 milestone Nov 16, 2020
@rgacogne rgacogne marked this pull request as ready for review November 16, 2020 11:11
@rgacogne
Copy link
Member

I'm attempting to rebase this PR on master because I would really like to merge it, but g++ 10.2.0 is complaining about the placement new and I'm not sure whether this is a real issue:

dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:373:232: warning: ‘new’ of type ‘MaxQPSIPRule’ with extended alignment 64 [-Waligned-new=]
  373 |       return std::shared_ptr<DNSRule>(new MaxQPSIPRule(qps, burst.get_value_or(qps), ipv4trunc.get_value_or(32), ipv6trunc.get_value_or(64), expiration.get_value_or(300), cleanupDelay.get_value_or(60), scanFraction.get_value_or(10)));
      |                                                                                                                                                                                                                                        ^
dnsdist-lua-rules.cc:373:232: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:373:232: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:378:59: warning: ‘new’ of type ‘MaxQPSRule’ with extended alignment 64 [-Waligned-new=]
  378 |         return std::shared_ptr<DNSRule>(new MaxQPSRule(qps));
      |                                                           ^
dnsdist-lua-rules.cc:378:59: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:378:59: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc:380:67: warning: ‘new’ of type ‘MaxQPSRule’ with extended alignment 64 [-Waligned-new=]
  380 |         return std::shared_ptr<DNSRule>(new MaxQPSRule(qps, *burst));
      |                                                                   ^
dnsdist-lua-rules.cc:380:67: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:380:67: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:384:56: warning: ‘new’ of type ‘RegexRule’ with extended alignment 64 [-Waligned-new=]
  384 |       return std::shared_ptr<DNSRule>(new RegexRule(str));
      |                                                        ^
dnsdist-lua-rules.cc:384:56: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:384:56: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:389:71: warning: ‘new’ of type ‘HTTPHeaderRule’ with extended alignment 64 [-Waligned-new=]
  389 |       return std::shared_ptr<DNSRule>(new HTTPHeaderRule(header, regex));
      |                                                                       ^
dnsdist-lua-rules.cc:389:71: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:389:71: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:392:60: warning: ‘new’ of type ‘HTTPPathRule’ with extended alignment 64 [-Waligned-new=]
  392 |       return std::shared_ptr<DNSRule>(new HTTPPathRule(path));
      |                                                            ^
dnsdist-lua-rules.cc:392:60: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:392:60: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:395:66: warning: ‘new’ of type ‘HTTPPathRegexRule’ with extended alignment 64 [-Waligned-new=]
  395 |       return std::shared_ptr<DNSRule>(new HTTPPathRegexRule(regex));
      |                                                                  ^
dnsdist-lua-rules.cc:395:66: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:395:66: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:401:54: warning: ‘new’ of type ‘RE2Rule’ with extended alignment 64 [-Waligned-new=]
  401 |       return std::shared_ptr<DNSRule>(new RE2Rule(str));
      |                                                      ^
dnsdist-lua-rules.cc:401:54: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:401:54: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:406:55: warning: ‘new’ of type ‘SNIRule’ with extended alignment 64 [-Waligned-new=]
  406 |       return std::shared_ptr<DNSRule>(new SNIRule(name));
      |                                                       ^
dnsdist-lua-rules.cc:406:55: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:406:55: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:410:90: warning: ‘new’ of type ‘SuffixMatchNodeRule’ with extended alignment 64 [-Waligned-new=]
  410 |       return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn, quiet ? *quiet : false));
      |                                                                                          ^
dnsdist-lua-rules.cc:410:90: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:410:90: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:414:106: warning: ‘new’ of type ‘NetmaskGroupRule’ with extended alignment 64 [-Waligned-new=]
  414 |       return std::shared_ptr<DNSRule>(new NetmaskGroupRule(nmg, src ? *src : true, quiet ? *quiet : false));
      |                                                                                                          ^
dnsdist-lua-rules.cc:414:106: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:414:106: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:457:51: warning: ‘new’ of type ‘AllRule’ with extended alignment 64 [-Waligned-new=]
  457 |       return std::shared_ptr<DNSRule>(new AllRule());
      |                                                   ^
dnsdist-lua-rules.cc:457:51: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:457:51: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:461:58: warning: ‘new’ of type ‘ProbaRule’ with extended alignment 64 [-Waligned-new=]
  461 |       return std::shared_ptr<DNSRule>(new ProbaRule(proba));
      |                                                          ^
dnsdist-lua-rules.cc:461:58: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:461:58: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:465:67: warning: ‘new’ of type ‘QNameRule’ with extended alignment 64 [-Waligned-new=]
  465 |       return std::shared_ptr<DNSRule>(new QNameRule(DNSName(qname)));
      |                                                                   ^
dnsdist-lua-rules.cc:465:67: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:465:67: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:479:58: warning: ‘new’ of type ‘QTypeRule’ with extended alignment 64 [-Waligned-new=]
  479 |       return std::shared_ptr<DNSRule>(new QTypeRule(qtype));
      |                                                          ^
dnsdist-lua-rules.cc:479:58: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:479:58: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:483:55: warning: ‘new’ of type ‘QClassRule’ with extended alignment 64 [-Waligned-new=]
  483 |       return std::shared_ptr<DNSRule>(new QClassRule(c));
      |                                                       ^
dnsdist-lua-rules.cc:483:55: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:483:55: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:487:58: warning: ‘new’ of type ‘OpcodeRule’ with extended alignment 64 [-Waligned-new=]
  487 |       return std::shared_ptr<DNSRule>(new OpcodeRule(code));
      |                                                          ^
dnsdist-lua-rules.cc:487:58: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:487:58: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:491:52: warning: ‘new’ of type ‘AndRule’ with extended alignment 64 [-Waligned-new=]
  491 |       return std::shared_ptr<DNSRule>(new AndRule(a));
      |                                                    ^
dnsdist-lua-rules.cc:491:52: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:491:52: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:495:51: warning: ‘new’ of type ‘OrRule’ with extended alignment 64 [-Waligned-new=]
  495 |       return std::shared_ptr<DNSRule>(new OrRule(a));
      |                                                   ^
dnsdist-lua-rules.cc:495:51: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:495:51: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:499:59: warning: ‘new’ of type ‘DSTPortRule’ with extended alignment 64 [-Waligned-new=]
  499 |       return std::shared_ptr<DNSRule>(new DSTPortRule(port));
      |                                                           ^
dnsdist-lua-rules.cc:499:59: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:499:59: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:503:54: warning: ‘new’ of type ‘TCPRule’ with extended alignment 64 [-Waligned-new=]
  503 |       return std::shared_ptr<DNSRule>(new TCPRule(tcp));
      |                                                      ^
dnsdist-lua-rules.cc:503:54: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:503:54: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:507:54: warning: ‘new’ of type ‘DNSSECRule’ with extended alignment 64 [-Waligned-new=]
  507 |       return std::shared_ptr<DNSRule>(new DNSSECRule());
      |                                                      ^
dnsdist-lua-rules.cc:507:54: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:507:54: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:511:55: warning: ‘new’ of type ‘NotRule’ with extended alignment 64 [-Waligned-new=]
  511 |       return std::shared_ptr<DNSRule>(new NotRule(rule));
      |                                                       ^
dnsdist-lua-rules.cc:511:55: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:511:55: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:515:87: warning: ‘new’ of type ‘RecordsCountRule’ with extended alignment 64 [-Waligned-new=]
  515 |       return std::shared_ptr<DNSRule>(new RecordsCountRule(section, minCount, maxCount));
      |                                                                                       ^
dnsdist-lua-rules.cc:515:87: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:515:87: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:519:97: warning: ‘new’ of type ‘RecordsTypeCountRule’ with extended alignment 64 [-Waligned-new=]
  519 |       return std::shared_ptr<DNSRule>(new RecordsTypeCountRule(section, type, minCount, maxCount));
      |                                                                                                 ^
dnsdist-lua-rules.cc:519:97: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:519:97: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:523:60: warning: ‘new’ of type ‘TrailingDataRule’ with extended alignment 64 [-Waligned-new=]
  523 |       return std::shared_ptr<DNSRule>(new TrailingDataRule());
      |                                                            ^
dnsdist-lua-rules.cc:523:60: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:523:60: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:527:94: warning: ‘new’ of type ‘QNameLabelsCountRule’ with extended alignment 64 [-Waligned-new=]
  527 |       return std::shared_ptr<DNSRule>(new QNameLabelsCountRule(minLabelsCount, maxLabelsCount));
      |                                                                                              ^
dnsdist-lua-rules.cc:527:94: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:527:94: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:531:71: warning: ‘new’ of type ‘QNameWireLengthRule’ with extended alignment 64 [-Waligned-new=]
  531 |       return std::shared_ptr<DNSRule>(new QNameWireLengthRule(min, max));
      |                                                                       ^
dnsdist-lua-rules.cc:531:71: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:531:71: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:535:58: warning: ‘new’ of type ‘RCodeRule’ with extended alignment 64 [-Waligned-new=]
  535 |       return std::shared_ptr<DNSRule>(new RCodeRule(rcode));
      |                                                          ^
dnsdist-lua-rules.cc:535:58: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:535:58: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:539:59: warning: ‘new’ of type ‘ERCodeRule’ with extended alignment 64 [-Waligned-new=]
  539 |       return std::shared_ptr<DNSRule>(new ERCodeRule(rcode));
      |                                                           ^
dnsdist-lua-rules.cc:539:59: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:539:59: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:543:66: warning: ‘new’ of type ‘EDNSVersionRule’ with extended alignment 64 [-Waligned-new=]
  543 |       return std::shared_ptr<DNSRule>(new EDNSVersionRule(version));
      |                                                                  ^
dnsdist-lua-rules.cc:543:66: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:543:66: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:547:65: warning: ‘new’ of type ‘EDNSOptionRule’ with extended alignment 64 [-Waligned-new=]
  547 |       return std::shared_ptr<DNSRule>(new EDNSOptionRule(optcode));
      |                                                                 ^
dnsdist-lua-rules.cc:547:65: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:547:65: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:555:50: warning: ‘new’ of type ‘RDRule’ with extended alignment 64 [-Waligned-new=]
  555 |       return std::shared_ptr<DNSRule>(new RDRule());
      |                                                  ^
dnsdist-lua-rules.cc:555:50: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:555:50: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:559:61: warning: ‘new’ of type ‘TagRule’ with extended alignment 64 [-Waligned-new=]
  559 |       return std::shared_ptr<DNSRule>(new TagRule(tag, value));
      |                                                             ^
dnsdist-lua-rules.cc:559:61: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:559:61: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:563:65: warning: ‘new’ of type ‘TimedIPSetRule’ with extended alignment 64 [-Waligned-new=]
  563 |       return std::shared_ptr<TimedIPSetRule>(new TimedIPSetRule());
      |                                                                 ^
dnsdist-lua-rules.cc:563:65: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:563:65: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:567:67: warning: ‘new’ of type ‘PoolAvailableRule’ with extended alignment 64 [-Waligned-new=]
  567 |     return std::shared_ptr<DNSRule>(new PoolAvailableRule(poolname));
      |                                                                   ^
dnsdist-lua-rules.cc:567:67: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:567:67: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:587:61: warning: ‘new’ of type ‘QNameSetRule’ with extended alignment 64 [-Waligned-new=]
  587 |       return std::shared_ptr<DNSRule>(new QNameSetRule(names));
      |                                                             ^
dnsdist-lua-rules.cc:587:61: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:587:61: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:591:81: warning: ‘new’ of type ‘KeyValueStoreLookupRule’ with extended alignment 64 [-Waligned-new=]
  591 |       return std::shared_ptr<DNSRule>(new KeyValueStoreLookupRule(kvs, lookupKey));
      |                                                                                 ^
dnsdist-lua-rules.cc:591:81: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:591:81: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:595:55: warning: ‘new’ of type ‘LuaRule’ with extended alignment 64 [-Waligned-new=]
  595 |       return std::shared_ptr<DNSRule>(new LuaRule(func));
      |                                                       ^
dnsdist-lua-rules.cc:595:55: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:595:55: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua-rules.cc: In lambda function:
dnsdist-lua-rules.cc:599:58: warning: ‘new’ of type ‘LuaFFIRule’ with extended alignment 64 [-Waligned-new=]
  599 |       return std::shared_ptr<DNSRule>(new LuaFFIRule(func));
      |                                                          ^
dnsdist-lua-rules.cc:599:58: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua-rules.cc:599:58: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
  CXX      dnsdist-systemd.o
  CXX      dnsdist-tcp-downstream.o
  CXX      dnsdist-tcp.o
  CXX      dnsdist-web.o
  CXX      dnsdist-xpf.o
  CXX      dnsdist.o
  GEN      dnsdist@.service
dnsdist-lua.cc: In lambda function:
dnsdist-lua.cc:615:136: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
  615 |         g_frontends.push_back(std::unique_ptr<ClientState>(new ClientState(loc, false, reusePort, tcpFastOpenQueueSize, interface, cpus)));
      |                                                                                                                                        ^
dnsdist-lua.cc:615:136: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:615:136: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc:616:126: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
  616 |         auto tcpCS = std::unique_ptr<ClientState>(new ClientState(loc, true, reusePort, tcpFastOpenQueueSize, interface, cpus));
      |                                                                                                                              ^
dnsdist-lua.cc:616:126: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:616:126: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc: In lambda function:
dnsdist-lua.cc:650:136: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
  650 |         g_frontends.push_back(std::unique_ptr<ClientState>(new ClientState(loc, false, reusePort, tcpFastOpenQueueSize, interface, cpus)));
      |                                                                                                                                        ^
dnsdist-lua.cc:650:136: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:650:136: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc:651:126: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
  651 |         auto tcpCS = std::unique_ptr<ClientState>(new ClientState(loc, true, reusePort, tcpFastOpenQueueSize, interface, cpus));
      |                                                                                                                              ^
dnsdist-lua.cc:651:126: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:651:126: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc: In lambda function:
dnsdist-lua.cc:1333:144: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 1333 |         auto cs = std::unique_ptr<ClientState>(new ClientState(ComboAddress(addr, 443), false, reusePort, tcpFastOpenQueueSize, interface, cpus));
      |                                                                                                                                                ^
dnsdist-lua.cc:1333:144: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:1333:144: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc:1339:138: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 1339 |         cs = std::unique_ptr<ClientState>(new ClientState(ComboAddress(addr, 443), true, reusePort, tcpFastOpenQueueSize, interface, cpus));
      |                                                                                                                                          ^
dnsdist-lua.cc:1339:138: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:1339:138: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc: In lambda function:
dnsdist-lua.cc:2037:133: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 2037 |     auto cs = std::unique_ptr<ClientState>(new ClientState(frontend->d_local, true, reusePort, tcpFastOpenQueueSize, interface, cpus));
      |                                                                                                                                     ^
dnsdist-lua.cc:2037:133: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:2037:133: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist-lua.cc: In lambda function:
dnsdist-lua.cc:2215:138: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 2215 |           auto cs = std::unique_ptr<ClientState>(new ClientState(frontend->d_addr, true, reusePort, tcpFastOpenQueueSize, interface, cpus));
      |                                                                                                                                          ^
dnsdist-lua.cc:2215:138: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist-lua.cc:2215:138: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
  CXXLD    testrunner
dnsdist.cc: In function ‘int main(int, char**)’:
dnsdist.cc:2246:120: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 2246 |       g_frontends.push_back(std::unique_ptr<ClientState>(new ClientState(ComboAddress(loc, 53), false, false, 0, "", {})));
      |                                                                                                                        ^
dnsdist.cc:2246:120: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist.cc:2246:120: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist.cc:2248:119: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 2248 |       g_frontends.push_back(std::unique_ptr<ClientState>(new ClientState(ComboAddress(loc, 53), true, false, 0, "", {})));
      |                                                                                                                       ^
dnsdist.cc:2248:119: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist.cc:2248:119: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist.cc:2254:126: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 2254 |     g_frontends.push_back(std::unique_ptr<ClientState>(new ClientState(ComboAddress("127.0.0.1", 53), false, false, 0, "", {})));
      |                                                                                                                              ^
dnsdist.cc:2254:126: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist.cc:2254:126: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist.cc:2256:125: warning: ‘new’ of type ‘ClientState’ with extended alignment 64 [-Waligned-new=]
 2256 |     g_frontends.push_back(std::unique_ptr<ClientState>(new ClientState(ComboAddress("127.0.0.1", 53), true, false, 0, "", {})));
      |                                                                                                                             ^
dnsdist.cc:2256:125: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist.cc:2256:125: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
dnsdist.cc:2345:126: warning: ‘new’ of type ‘TCPClientCollection’ with extended alignment 64 [-Waligned-new=]
 2345 |   g_tcpclientthreads = std::unique_ptr<TCPClientCollection>(new TCPClientCollection(g_maxTCPClientThreads, g_useTCPSinglePipe));
      |                                                                                                                              ^
dnsdist.cc:2345:126: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
dnsdist.cc:2345:126: note: use ‘-faligned-new’ to enable C++17 over-aligned new support

For what it is worth, clang 11.0.0 does not complain.

@rgacogne
Copy link
Member

I don't get warnings anymore after rebasing this PR on top of the current master, likely thanks to the move to C++17 :-)

@rgacogne
Copy link
Member

Otto, do you mind if a push a rebased branch? I'd like to merge this before 1.6.0-alpha1 :)

@rgacogne rgacogne mentioned this pull request Jan 21, 2021
7 tasks
@rgacogne
Copy link
Member

Superseded by #9998.

@rgacogne rgacogne closed this Jan 26, 2021
@omoerbeek omoerbeek deleted the dnsdist-aligned-atomics branch February 19, 2021 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Statistics counters use atomics without padding (false sharing)
3 participants