Find a file
Kuniyuki Iwashima aa99e5f87b tcp: Fix bind() regression for v4-mapped-v6 wildcard address.
Andrei Vagin reported bind() regression with strace logs.

If we bind() a TCPv6 socket to ::FFFF:0.0.0.0 and then bind() a TCPv4
socket to 127.0.0.1, the 2nd bind() should fail but now succeeds.

  from socket import *

  s1 = socket(AF_INET6, SOCK_STREAM)
  s1.bind(('::ffff:0.0.0.0', 0))

  s2 = socket(AF_INET, SOCK_STREAM)
  s2.bind(('127.0.0.1', s1.getsockname()[1]))

During the 2nd bind(), if tb->family is AF_INET6 and sk->sk_family is
AF_INET in inet_bind2_bucket_match_addr_any(), we still need to check
if tb has the v4-mapped-v6 wildcard address.

The example above does not work after commit 5456262d2b ("net: Fix
incorrect address comparison when searching for a bind2 bucket"), but
the blamed change is not the commit.

Before the commit, the leading zeros of ::FFFF:0.0.0.0 were treated
as 0.0.0.0, and the sequence above worked by chance.  Technically, this
case has been broken since bhash2 was introduced.

Note that if we bind() two sockets to 127.0.0.1 and then ::FFFF:0.0.0.0,
the 2nd bind() fails properly because we fall back to using bhash to
detect conflicts for the v4-mapped-v6 address.

Fixes: 28044fc1d4 ("net: Add a bhash2 table hashed by port and address")
Reported-by: Andrei Vagin <avagin@google.com>
Closes: https://lore.kernel.org/netdev/ZPuYBOFC8zsK6r9T@google.com/
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-09-13 07:18:04 +01:00
arch Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
block
certs
crypto
Documentation Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
drivers veth: Update XDP feature set when bringing up device 2023-09-12 16:32:56 +02:00
fs ntfs3: drop inode references in ntfs_put_super() 2023-09-07 10:23:37 -07:00
include tcp: Fix bind() regression for v4-mapped-v6 wildcard address. 2023-09-13 07:18:04 +01:00
init
io_uring
ipc
kernel Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
lib
LICENSES
mm Seven hotfixes. Four are cc:stable and the remainder pertain to issues 2023-09-05 12:22:39 -07:00
net tcp: Fix bind() regression for v4-mapped-v6 wildcard address. 2023-09-13 07:18:04 +01:00
rust
samples
scripts Including fixes from netfilter and bpf. 2023-09-07 18:33:07 -07:00
security
sound
tools selftests/net: Improve bind_bhash.sh to accommodate predictable network interface names 2023-09-10 18:49:29 +01:00
usr
virt ARM: 2023-09-07 13:52:20 -07:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS RTC for 6.6 2023-09-07 16:07:35 -07:00
Makefile Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.