lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 21 Oct 2022 13:44:33 -0700
From:   Kuniyuki Iwashima <kuniyu@...zon.com>
To:     "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
CC:     Martin KaFai Lau <martin.lau@...nel.org>,
        Craig Gallek <kraig@...gle.com>,
        Kazuho Oku <kazuhooku@...il.com>,
        Kuniyuki Iwashima <kuniyu@...zon.com>,
        Kuniyuki Iwashima <kuni1840@...il.com>,
        <netdev@...r.kernel.org>
Subject: [PATCH v3 net-next 0/2] soreuseport: Fix broken SO_INCOMING_CPU.

setsockopt(SO_INCOMING_CPU) for UDP/TCP is broken since 4.5/4.6 due to
these commits:

  * e32ea7e74727 ("soreuseport: fast reuseport UDP socket selection")
  * c125e80b8868 ("soreuseport: fast reuseport TCP socket selection")

These commits introduced the O(1) socket selection algorithm and removed
O(n) iteration over the list, but it ignores the score calculated by
compute_score().  As a result, it caused two misbehaviours:

  * Unconnected sockets receive packets sent to connected sockets
  * SO_INCOMING_CPU does not work

The former is fixed by commit acdcecc61285 ("udp: correct reuseport
selection with connected sockets").  This series fixes the latter and
adds some tests for SO_INCOMING_CPU.


Changes:
  v3:
    * Rebase and resolve conflicts

  v2: https://lore.kernel.org/netdev/20221020163954.93618-1-kuniyu@amazon.com/
    * patch 1
      * Rename helper functions
      * Remove unnecessary arg sk from '__' helpers
      * Fix reuseport_update_incoming_cpu() logic
    * patch 2
      * Add test cases
        * Change when to set SO_INCOMING_CPU
        * Add/Remove non-SO_INCOMING_CPU socket

  v1: https://lore.kernel.org/netdev/20221010174351.11024-1-kuniyu@amazon.com/


Kuniyuki Iwashima (2):
  soreuseport: Fix socket selection for SO_INCOMING_CPU.
  selftest: Add test for SO_INCOMING_CPU.

 include/net/sock_reuseport.h                  |   2 +
 net/core/sock.c                               |   2 +-
 net/core/sock_reuseport.c                     |  94 ++++++-
 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/so_incoming_cpu.c | 242 ++++++++++++++++++
 6 files changed, 336 insertions(+), 6 deletions(-)
 create mode 100644 tools/testing/selftests/net/so_incoming_cpu.c

-- 
2.30.2

Powered by blists - more mailing lists