<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/ipv4/bpfilter, branch master</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=master</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2024-01-04T18:23:10Z</updated>
<entry>
<title>bpfilter: remove bpfilter</title>
<updated>2024-01-04T18:23:10Z</updated>
<author>
<name>Quentin Deslandes</name>
<email>qde@naccy.de</email>
</author>
<published>2023-12-26T13:07:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=98e20e5e13d2811898921f999288be7151a11954'/>
<id>urn:sha1:98e20e5e13d2811898921f999288be7151a11954</id>
<content type='text'>
bpfilter was supposed to convert iptables filtering rules into
BPF programs on the fly, from the kernel, through a usermode
helper. The base code for the UMH was introduced in 2018, and
couple of attempts (2, 3) tried to introduce the BPF program
generate features but were abandoned.

bpfilter now sits in a kernel tree unused and unusable, occasionally
causing confusion amongst Linux users (4, 5).

As bpfilter is now developed in a dedicated repository on GitHub (6),
it was suggested a couple of times this year (LSFMM/BPF 2023,
LPC 2023) to remove the deprecated kernel part of the project. This
is the purpose of this patch.

[1]: https://lore.kernel.org/lkml/20180522022230.2492505-1-ast@kernel.org/
[2]: https://lore.kernel.org/bpf/20210829183608.2297877-1-me@ubique.spb.ru/#t
[3]: https://lore.kernel.org/lkml/20221224000402.476079-1-qde@naccy.de/
[4]: https://dxuuu.xyz/bpfilter.html
[5]: https://github.com/linuxkit/linuxkit/pull/3904
[6]: https://github.com/facebook/bpfilter

Signed-off-by: Quentin Deslandes &lt;qde@naccy.de&gt;
Link: https://lore.kernel.org/r/20231226130745.465988-1-qde@naccy.de
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: Use umd_cleanup_helper()</title>
<updated>2023-05-31T11:06:57Z</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2023-05-26T11:21:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9b68f30b68701e98abcec331a2cf3df972d910f8'/>
<id>urn:sha1:9b68f30b68701e98abcec331a2cf3df972d910f8</id>
<content type='text'>
bpfilter_umh_cleanup() is the same function as umd_cleanup_helper().
Drop the redundant function.

Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20230526112104.1044686-1-jarkko@kernel.org
</content>
</entry>
<entry>
<title>net: Revert "net: optimize the sockptr_t for unified kernel/user address spaces"</title>
<updated>2020-08-10T19:06:44Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-08-10T16:42:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=519a8a6cf91dda095be2d36216fc4ebc525270a1'/>
<id>urn:sha1:519a8a6cf91dda095be2d36216fc4ebc525270a1</id>
<content type='text'>
This reverts commits 6d04fe15f78acdf8e32329e208552e226f7a8ae6 and
a31edb2059ed4e498f9aa8230c734b59d0ad797a.

It turns out the idea to share a single pointer for both kernel and user
space address causes various kinds of problems.  So use the slightly less
optimal version that uses an extra bit, but which is guaranteed to be safe
everywhere.

Fixes: 6d04fe15f78a ("net: optimize the sockptr_t for unified kernel/user address spaces")
Reported-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: John Stultz &lt;john.stultz@linaro.org&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: improve the user pointer check in init_user_sockptr</title>
<updated>2020-07-28T20:43:40Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-07-28T16:38:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a31edb2059ed4e498f9aa8230c734b59d0ad797a'/>
<id>urn:sha1:a31edb2059ed4e498f9aa8230c734b59d0ad797a</id>
<content type='text'>
Make sure not just the pointer itself but the whole range lies in
the user address space.  For that pass the length and then use
the access_ok helper to do the check.

Fixes: 6d04fe15f78a ("net: optimize the sockptr_t for unified kernel/user address spaces")
Reported-by: David Laight &lt;David.Laight@ACULAB.COM&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: optimize the sockptr_t for unified kernel/user address spaces</title>
<updated>2020-07-24T22:41:54Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-07-23T06:09:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d04fe15f78acdf8e32329e208552e226f7a8ae6'/>
<id>urn:sha1:6d04fe15f78acdf8e32329e208552e226f7a8ae6</id>
<content type='text'>
For architectures like x86 and arm64 we don't need the separate bit to
indicate that a pointer is a kernel pointer as the address spaces are
unified.  That way the sockptr_t can be reduced to a union of two
pointers, which leads to nicer calling conventions.

The only caveat is that we need to check that users don't pass in kernel
address and thus gain access to kernel memory.  Thus the USER_SOCKPTR
helper is replaced with a init_user_sockptr function that does this check
and returns an error if it fails.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t</title>
<updated>2020-07-24T22:41:54Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-07-23T06:08:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b03afaa82ece13b2a008f0e3a7127bead578e3e6'/>
<id>urn:sha1:b03afaa82ece13b2a008f0e3a7127bead578e3e6</id>
<content type='text'>
This is mostly to prepare for cleaning up the callers, as bpfilter by
design can't handle kernel pointers.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpfilter: Take advantage of the facilities of struct pid</title>
<updated>2020-07-07T16:58:57Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2020-06-25T22:23:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e80eb1dc868bc1ed93602389d54b27f170ca770c'/>
<id>urn:sha1:e80eb1dc868bc1ed93602389d54b27f170ca770c</id>
<content type='text'>
Instead of relying on the exit_umh cleanup callback use the fact a
struct pid can be tested to see if a process still exists, and that
struct pid has a wait queue that notifies when the process dies.

v1: https://lkml.kernel.org/r/87h7uydlu9.fsf_-_@x220.int.ebiederm.org
v2: https://lkml.kernel.org/r/874kqt4owu.fsf_-_@x220.int.ebiederm.org
Link: https://lkml.kernel.org/r/20200702164140.4468-14-ebiederm@xmission.com
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Tested-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
</content>
</entry>
<entry>
<title>umd: Track user space drivers with struct pid</title>
<updated>2020-07-04T14:35:56Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2020-06-25T21:48:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1c340ead18ee4b4a84357abdef6d4f39ee08328b'/>
<id>urn:sha1:1c340ead18ee4b4a84357abdef6d4f39ee08328b</id>
<content type='text'>
Use struct pid instead of user space pid values that are prone to wrap
araound.

In addition track the entire thread group instead of just the first
thread that is started by exec.  There are no multi-threaded user mode
drivers today but there is nothing preclucing user drivers from being
multi-threaded, so it is just a good idea to track the entire process.

Take a reference count on the tgid's in question to make it possible
to remove exit_umh in a future change.

As a struct pid is available directly use kill_pid_info.

The prior process signalling code was iffy in using a userspace pid
known to be in the initial pid namespace and then looking up it's task
in whatever the current pid namespace is.  It worked only because
kernel threads always run in the initial pid namespace.

As the tgid is now refcounted verify the tgid is NULL at the start of
fork_usermode_driver to avoid the possibility of silent pid leaks.

v1: https://lkml.kernel.org/r/87mu4qdlv2.fsf_-_@x220.int.ebiederm.org
v2: https://lkml.kernel.org/r/a70l4oy8.fsf_-_@x220.int.ebiederm.org
Link: https://lkml.kernel.org/r/20200702164140.4468-12-ebiederm@xmission.com
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Tested-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
</content>
</entry>
<entry>
<title>umd: Rename umd_info.cmdline umd_info.driver_name</title>
<updated>2020-07-04T14:35:13Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2020-06-25T16:38:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1199c6c3da5197e9924a906b9de71b8d0ac62a01'/>
<id>urn:sha1:1199c6c3da5197e9924a906b9de71b8d0ac62a01</id>
<content type='text'>
The only thing supplied in the cmdline today is the driver name so
rename the field to clarify the code.

As this value is always supplied stop trying to handle the case of
a NULL cmdline.

Additionally since we now have a name we can count on use the
driver_name any place where the code is looking for a name
of the binary.

v1: https://lkml.kernel.org/r/87imfef0k3.fsf_-_@x220.int.ebiederm.org
v2: https://lkml.kernel.org/r/87366d63os.fsf_-_@x220.int.ebiederm.org
Link: https://lkml.kernel.org/r/20200702164140.4468-7-ebiederm@xmission.com
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Tested-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
</content>
</entry>
<entry>
<title>umd: For clarity rename umh_info umd_info</title>
<updated>2020-07-04T14:34:39Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2020-06-26T16:16:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74be2d3b80af1bb264c3b9905b52c15efc03c0fe'/>
<id>urn:sha1:74be2d3b80af1bb264c3b9905b52c15efc03c0fe</id>
<content type='text'>
This structure is only used for user mode drivers so change
the prefix from umh to umd to make that clear.

v1: https://lkml.kernel.org/r/87o8p6f0kw.fsf_-_@x220.int.ebiederm.org
v2: https://lkml.kernel.org/r/878sg563po.fsf_-_@x220.int.ebiederm.org
Link: https://lkml.kernel.org/r/20200702164140.4468-6-ebiederm@xmission.com
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Tested-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
</content>
</entry>
</feed>
