From: Richard Gobert <richardbgobert(a)gmail.com>
[ Upstream commit 0e4d354762cefd3e16b4cff8988ff276e45effc4 ]
The IP_UNICAST_IF socket option is used to set the outgoing interface
for outbound packets.
The IP_UNICAST_IF socket option was added as it was needed by the
Wine project, since no other existing option (SO_BINDTODEVICE socket
option, IP_PKTINFO socket option or the bind function) provided the
needed characteristics needed by the IP_UNICAST_IF socket option. [1]
The IP_UNICAST_IF socket option works well for unconnected sockets,
that is, the interface specified by the IP_UNICAST_IF socket option
is taken into consideration in the route lookup process when a packet
is being sent. However, for connected sockets, the outbound interface
is chosen when connecting the socket, and in the route lookup process
which is done when a packet is being sent, the interface specified by
the IP_UNICAST_IF socket option is being ignored.
This inconsistent behavior was reported and discussed in an issue
opened on systemd's GitHub project [2]. Also, a bug report was
submitted in the kernel's bugzilla [3].
To understand the problem in more detail, we can look at what happens
for UDP packets over IPv4 (The same analysis was done separately in
the referenced systemd issue).
When a UDP packet is sent the udp_sendmsg function gets called and
the following happens:
1. The oif member of the struct ipcm_cookie ipc (which stores the
output interface of the packet) is initialized by the ipcm_init_sk
function to inet->sk.sk_bound_dev_if (the device set by the
SO_BINDTODEVICE socket option).
2. If the IP_PKTINFO socket option was set, the oif member gets
overridden by the call to the ip_cmsg_send function.
3. If no output interface was selected yet, the interface specified
by the IP_UNICAST_IF socket option is used.
4. If the socket is connected and no destination address is
specified in the send function, the struct ipcm_cookie ipc is not
taken into consideration and the cached route, that was calculated in
the connect function is being used.
Thus, for a connected socket, the IP_UNICAST_IF sockopt isn't taken
into consideration.
This patch corrects the behavior of the IP_UNICAST_IF socket option
for connect()ed sockets by taking into consideration the
IP_UNICAST_IF sockopt when connecting the socket.
In order to avoid reconnecting the socket, this option is still
ignored when applied on an already connected socket until connect()
is called again by the Richard Gobert.
Change the __ip4_datagram_connect function, which is called during
socket connection, to take into consideration the interface set by
the IP_UNICAST_IF socket option, in a similar way to what is done in
the udp_sendmsg function.
[1] https://lore.kernel.org/netdev/1328685717.4736.4.camel@edumazet-laptop/T/
[2] https://github.com/systemd/systemd/issues/11935#issuecomment-618691018
[3] https://bugzilla.kernel.org/show_bug.cgi?id=210255
Signed-off-by: Richard Gobert <richardbgobert(a)gmail.com>
Reviewed-by: David Ahern <dsahern(a)kernel.org>
Link: https://lore.kernel.org/r/20220829111554.GA1771@debian
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
net/ipv4/datagram.c | 2 ++
tools/testing/selftests/net/fcnal-test.sh | 30 +++++++++++++++++++++++
tools/testing/selftests/net/nettest.c | 16 ++++++++++--
3 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index ffd57523331f..405a8c2aea64 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -42,6 +42,8 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
oif = inet->mc_index;
if (!saddr)
saddr = inet->mc_addr;
+ } else if (!oif) {
+ oif = inet->uc_index;
}
fl4 = &inet->cork.fl.u.ip4;
rt = ip_route_connect(fl4, usin->sin_addr.s_addr, saddr, oif,
diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index 03b586760164..31c3b6ebd388 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
@@ -1466,6 +1466,13 @@ ipv4_udp_novrf()
run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP}
log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF"
+ log_start
+ run_cmd_nsb nettest -D -s &
+ sleep 1
+ run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} -U
+ log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF, with connect()"
+
+
log_start
show_hint "Should fail 'Connection refused'"
run_cmd nettest -D -r ${a}
@@ -1525,6 +1532,13 @@ ipv4_udp_novrf()
run_cmd nettest -D -d ${NSA_DEV} -S -r ${a}
log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection"
+ log_start
+ run_cmd nettest -s -D &
+ sleep 1
+ run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} -U
+ log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection, with connect()"
+
+
# IPv4 with device bind has really weird behavior - it overrides the
# fib lookup, generates an rtable and tries to send the packet. This
# causes failures for local traffic at different places
@@ -1550,6 +1564,15 @@ ipv4_udp_novrf()
sleep 1
run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S
log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection"
+
+ log_start
+ show_hint "Should fail since addresses on loopback are out of device scope"
+ run_cmd nettest -D -s &
+ sleep 1
+ run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -U
+ log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()"
+
+
done
a=${NSA_IP}
@@ -3157,6 +3180,13 @@ ipv6_udp_novrf()
sleep 1
run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S
log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection"
+
+ log_start
+ show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope"
+ run_cmd nettest -6 -D -s &
+ sleep 1
+ run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -U
+ log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()"
done
a=${NSA_IP6}
diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c
index d9a6fd2cd9d3..7900fa98eccb 100644
--- a/tools/testing/selftests/net/nettest.c
+++ b/tools/testing/selftests/net/nettest.c
@@ -127,6 +127,9 @@ struct sock_args {
/* ESP in UDP encap test */
int use_xfrm;
+
+ /* use send() and connect() instead of sendto */
+ int datagram_connect;
};
static int server_mode;
@@ -979,6 +982,11 @@ static int send_msg(int sd, void *addr, socklen_t alen, struct sock_args *args)
log_err_errno("write failed sending msg to peer");
return 1;
}
+ } else if (args->datagram_connect) {
+ if (send(sd, msg, msglen, 0) < 0) {
+ log_err_errno("send failed sending msg to peer");
+ return 1;
+ }
} else if (args->ifindex && args->use_cmsg) {
if (send_msg_cmsg(sd, addr, alen, args->ifindex, args->version))
return 1;
@@ -1659,7 +1667,7 @@ static int connectsock(void *addr, socklen_t alen, struct sock_args *args)
if (args->has_local_ip && bind_socket(sd, args))
goto err;
- if (args->type != SOCK_STREAM)
+ if (args->type != SOCK_STREAM && !args->datagram_connect)
goto out;
if (args->password && tcp_md5sig(sd, addr, alen, args))
@@ -1854,7 +1862,7 @@ static int ipc_parent(int cpid, int fd, struct sock_args *args)
return client_status;
}
-#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbqf"
+#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SUCi6xL:0:1:2:3:Fbqf"
#define OPT_FORCE_BIND_KEY_IFINDEX 1001
#define OPT_NO_BIND_KEY_IFINDEX 1002
@@ -1891,6 +1899,7 @@ static void print_usage(char *prog)
" -I dev bind socket to given device name - server mode\n"
" -S use setsockopt (IP_UNICAST_IF or IP_MULTICAST_IF)\n"
" to set device binding\n"
+ " -U Use connect() and send() for datagram sockets\n"
" -f bind socket with the IP[V6]_FREEBIND option\n"
" -C use cmsg and IP_PKTINFO to specify device binding\n"
"\n"
@@ -2074,6 +2083,9 @@ int main(int argc, char *argv[])
case 'x':
args.use_xfrm = 1;
break;
+ case 'U':
+ args.datagram_connect = 1;
+ break;
default:
print_usage(argv[0]);
return 1;
--
2.35.1
Hi,
On Sat, Oct 08, 2022 at 04:57:43PM +0800, kernel test robot wrote:
(...)
> 2022-10-02 10:04:53 make TARGETS=nolibc
> make[1]: Entering directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-362aecb2d8cfad0268d6c0ae5f448e9b6eee7ffb/tools/testing/selftests/nolibc'
> CC nolibc-test
> /usr/bin/ld: /tmp/cccOWbdp.o: in function `printf':
> nolibc-test.c:(.text+0x369): undefined reference to `strlen'
> collect2: error: ld returned 1 exit status
> make[1]: *** [Makefile:31: nolibc-test] Error 1
> make[1]: Leaving directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-362aecb2d8cfad0268d6c0ae5f448e9b6eee7ffb/tools/testing/selftests/nolibc'
> make: *** [Makefile:155: all] Error 2
> 2022-10-02 10:04:53 make -C nolibc
> make: Entering directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-362aecb2d8cfad0268d6c0ae5f448e9b6eee7ffb/tools/testing/selftests/nolibc'
> CC nolibc-test
> /usr/bin/ld: /tmp/lkp/ccP4fovP.o: in function `printf':
> nolibc-test.c:(.text+0x369): undefined reference to `strlen'
> collect2: error: ld returned 1 exit status
> make: *** [Makefile:31: nolibc-test] Error 1
> make: Leaving directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-362aecb2d8cfad0268d6c0ae5f448e9b6eee7ffb/tools/testing/selftests/nolibc'
> 2022-10-02 10:04:54 make quicktest=1 run_tests -C nolibc
> make: Entering directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-362aecb2d8cfad0268d6c0ae5f448e9b6eee7ffb/tools/testing/selftests/nolibc'
> make: *** No rule to make target 'run_tests'. Stop.
> make: Leaving directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-362aecb2d8cfad0268d6c0ae5f448e9b6eee7ffb/tools/testing/selftests/nolibc'
>
>
> This error only happens when build with gcc-12, while gcc-11 and gcc-9
> build fine. We are not sure whether this is a compiler issue or a kernel
> code issue, so we send this report FYI. Below link may be helpful for
> analysis:
>
> https://www.spinics.net/lists/fedora-devel/msg296395.html
(...)
Many thanks for the detailed report and hints. Since we're only providing
include files we don't always have the luxury of enforcing build options
on the caller, so it took me quite some trial and error but I finally
found a way around it. I'm sending a updated patch to Paul for merging.
Thanks again,
Willy
From: "Hans J. Schultz" <netdev(a)kapio-technology.com>
This patch set extends the locked port feature for devices
that are behind a locked port, but do not have the ability to
authorize themselves as a supplicant using IEEE 802.1X.
Such devices can be printers, meters or anything related to
fixed installations. Instead of 802.1X authorization, devices
can get access based on their MAC addresses being whitelisted.
For an authorization daemon to detect that a device is trying
to get access through a locked port, the bridge will add the
MAC address of the device to the FDB with a locked flag to it.
Thus the authorization daemon can catch the FDB add event and
check if the MAC address is in the whitelist and if so replace
the FDB entry without the locked flag enabled, and thus open
the port for the device.
This feature is known as MAC-Auth or MAC Authentication Bypass
(MAB) in Cisco terminology, where the full MAB concept involves
additional Cisco infrastructure for authorization. There is no
real authentication process, as the MAC address of the device
is the only input the authorization daemon, in the general
case, has to base the decision if to unlock the port or not.
With this patch set, an implementation of the offloaded case is
supplied for the mv88e6xxx driver. When a packet ingresses on
a locked port, an ATU miss violation event will occur. When
handling such ATU miss violation interrupts, the MAC address of
the device is added to the FDB with a zero destination port
vector (DPV) and the MAC address is communicated through the
switchdev layer to the bridge, so that a FDB entry with the
locked flag enabled can be added.
Log:
v3: Added timers and lists in the driver (mv88e6xxx)
to keep track of and remove locked entries.
v4: Leave out enforcing a limit to the number of
locked entries in the bridge.
Removed the timers in the driver and use the
worker only. Add locked FDB flag to all drivers
using port_fdb_add() from the dsa api and let
all drivers ignore entries with this flag set.
Change how to get the ageing timeout of locked
entries. See global1_atu.c and switchdev.c.
Use struct mv88e6xxx_port for locked entries
variables instead of struct dsa_port.
v5: Added 'mab' flag to enable MAB/MacAuth feature,
in a similar way to the locked feature flag.
In these implementations for the mv88e6xxx, the
switchport must be configured with learning on.
To tell userspace about the behavior of the
locked entries in the driver, a 'blackhole'
FDB flag has been added, which locked FDB
entries coming from the driver gets. Also the
'sticky' flag comes with those locked entries,
as the drivers locked entries cannot roam.
Fixed issues with taking mutex locks, and added
a function to read the fid, that supports all
versions of the chipset family.
v6: Added blackhole FDB flag instead of using sticky
flag, as the blackhole flag corresponds to the
behaviour of the zero-DPV locked entries in the
driver.
Userspace can add blackhole FDB entries with:
# bridge fdb add MAC dev br0 blackhole
Added FDB flags towards driver in DSA layer as u16.
Hans J. Schultz (9):
net: bridge: add locked entry fdb flag to extend locked port feature
net: bridge: add blackhole fdb entry flag
net: switchdev: add support for offloading of the FDB locked flag
net: switchdev: support offloading of the FDB blackhole flag
drivers: net: dsa: add fdb entry flags to drivers
net: dsa: mv88e6xxx: allow reading FID when handling ATU violations
net: dsa: mv88e6xxx: mac-auth/MAB implementation
net: dsa: mv88e6xxx: add blackhole ATU entries
selftests: forwarding: add test of MAC-Auth Bypass to locked port
tests
drivers/net/dsa/b53/b53_common.c | 12 +-
drivers/net/dsa/b53/b53_priv.h | 4 +-
drivers/net/dsa/hirschmann/hellcreek.c | 12 +-
drivers/net/dsa/lan9303-core.c | 12 +-
drivers/net/dsa/lantiq_gswip.c | 12 +-
drivers/net/dsa/microchip/ksz9477.c | 8 +-
drivers/net/dsa/microchip/ksz9477.h | 8 +-
drivers/net/dsa/microchip/ksz_common.c | 14 +-
drivers/net/dsa/mt7530.c | 12 +-
drivers/net/dsa/mv88e6xxx/Makefile | 1 +
drivers/net/dsa/mv88e6xxx/chip.c | 158 +++++++++-
drivers/net/dsa/mv88e6xxx/chip.h | 19 ++
drivers/net/dsa/mv88e6xxx/global1.h | 1 +
drivers/net/dsa/mv88e6xxx/global1_atu.c | 72 ++++-
drivers/net/dsa/mv88e6xxx/port.c | 15 +-
drivers/net/dsa/mv88e6xxx/port.h | 6 +
drivers/net/dsa/mv88e6xxx/switchdev.c | 284 ++++++++++++++++++
drivers/net/dsa/mv88e6xxx/switchdev.h | 37 +++
drivers/net/dsa/ocelot/felix.c | 12 +-
drivers/net/dsa/qca/qca8k-common.c | 10 +-
drivers/net/dsa/qca/qca8k.h | 4 +-
drivers/net/dsa/sja1105/sja1105_main.c | 14 +-
include/linux/if_bridge.h | 1 +
include/net/dsa.h | 7 +-
include/net/switchdev.h | 2 +
include/uapi/linux/if_link.h | 1 +
include/uapi/linux/neighbour.h | 11 +-
net/bridge/br.c | 5 +-
net/bridge/br_fdb.c | 77 ++++-
net/bridge/br_input.c | 20 +-
net/bridge/br_netlink.c | 12 +-
net/bridge/br_private.h | 5 +-
net/bridge/br_switchdev.c | 4 +-
net/core/rtnetlink.c | 9 +
net/dsa/dsa_priv.h | 10 +-
net/dsa/port.c | 32 +-
net/dsa/slave.c | 16 +-
net/dsa/switch.c | 24 +-
.../net/forwarding/bridge_blackhole_fdb.sh | 102 +++++++
.../net/forwarding/bridge_locked_port.sh | 106 ++++++-
.../net/forwarding/bridge_sticky_fdb.sh | 21 +-
tools/testing/selftests/net/forwarding/lib.sh | 18 ++
42 files changed, 1093 insertions(+), 117 deletions(-)
create mode 100644 drivers/net/dsa/mv88e6xxx/switchdev.c
create mode 100644 drivers/net/dsa/mv88e6xxx/switchdev.h
create mode 100755 tools/testing/selftests/net/forwarding/bridge_blackhole_fdb.sh
--
2.34.1
On 10/6/22 16:41, Sadiya Kazi wrote:
> Consider updating this section as below:
> In this section, you will learn how to write a program to test the addition
> of two numbers using KUnit. To do so, you must write the addition driver
> code followed by the test case.
>
> 1.To write the addition driver code, follow the steps given below:
>
>> a.Navigate to the Kernel repository.
>
> b.Create a file ``drivers/misc/example.h``.
> c.In the ``example.h`` file, add the following code to declare the
> function ``misc_example_add()``:
>
>>
>> -1. Create a file ``drivers/misc/example.h``, which includes:
>> +1. Write the feature that will be tested. First, write the declaration
>> + for ``misc_example_add()`` in ``drivers/misc/example.h``:
>>
>> -.. code-block:: c
>> + .. code-block:: c
>>
>> int misc_example_add(int left, int right);
>>
>> -2. Create a file ``drivers/misc/example.c``, which includes:
>> + Then implement the function in ``drivers/misc/example.c``:
>
>
> d. To implement the function, create a file ``drivers/misc/example.c` and
> add the following code to it:
>
>
>>
>> -.. code-block:: c
>> + .. code-block:: c
>>
>> #include <linux/errno.h>
>>
>> @@ -152,24 +154,25 @@ In your kernel repository, let's add some code that
>> we can test.
>> return left + right;
>> }
>>
>> -3. Add the following lines to ``drivers/misc/Kconfig``:
>> +2. Add Kconfig menu entry for the feature to ``drivers/misc/Kconfig``:
>>
>
> e. Update ``drivers/misc/Kconfig`` with the following code to add the
> driver configuration:
>
>
>>
>> -.. code-block:: kconfig
>> + .. code-block:: kconfig
>>
>> config MISC_EXAMPLE
>> bool "My example"
>>
>> -4. Add the following lines to ``drivers/misc/Makefile``:
>> +3. Add the kbuild goal that will build the feature to
>> + ``drivers/misc/Makefile``:
>>
> f.To build the feature, update ``drivers/misc/Makefile`` with the following
> code:
>
>
>>
>> -.. code-block:: make
>> + .. code-block:: make
>>
>> obj-$(CONFIG_MISC_EXAMPLE) += example.o
>>
>> Now we are ready to write the test cases.
>>
> 2. To write the test cases, follow the steps given below:
>
>>
>> -1. Add the below test case in ``drivers/misc/example_test.c``:
>> +1. Write the test in ``drivers/misc/example_test.c``:
>>
> a. Write the test in ``drivers/misc/example_test.c``:
>
>>
>> -.. code-block:: c
>> + .. code-block:: c
>>
>> #include <kunit/test.h>
>> #include "example.h"
>> @@ -202,31 +205,32 @@ Now we are ready to write the test cases.
>> };
>> kunit_test_suite(misc_example_test_suite);
>>
>> -2. Add the following lines to ``drivers/misc/Kconfig``:
>> +2. Add following Kconfig entry for the test to ``drivers/misc/Kconfig``:
>>
> b. Add the following test configuration to ``drivers/misc/Kconfig``:
>
>>
>> -.. code-block:: kconfig
>> + .. code-block:: kconfig
>>
>> config MISC_EXAMPLE_TEST
>> tristate "Test for my example" if !KUNIT_ALL_TESTS
>> depends on MISC_EXAMPLE && KUNIT=y
>> default KUNIT_ALL_TESTS
>>
>> -3. Add the following lines to ``drivers/misc/Makefile``:
>> +3. Add kbuild goal of the test to ``drivers/misc/Makefile``:
>>
> c. Update ``drivers/misc/Makefile`` with the following code:
>
>>
>> -.. code-block:: make
>> + .. code-block:: make
>>
>> obj-$(CONFIG_MISC_EXAMPLE_TEST) += example_test.o
>>
>> -4. Add following configuration fragments to ``.kunit/.kunitconfig``:
>> +4. Add following configuration fragments for the test to
>> + ``.kunit/.kunitconfig``:
>>
> d. Add the following test configuration to ``.kunit/.kunitconfig``:
>
>>
>> -.. code-block:: none
>> + .. code-block:: none
>>
>> CONFIG_MISC_EXAMPLE=y
>> CONFIG_MISC_EXAMPLE_TEST=y
>>
>> 5. Run the test:
>>
> e. Run the test using the following command:
>
>>
>> -.. code-block:: bash
>> + .. code-block:: bash
>>
>> ./tools/testing/kunit/kunit.py run
>>
I think the documentation assumes the knowledge of writing kernel
code (C language and build infrastructure). This means that the
instructions should be written for brevity.
--
An old man doll... just what I always wanted! - Clara
Hi Linus,
Please pull the following KUnit update for Linux 6.1-rc1.
This KUnit update for Linux 6.1-rc1 consists of several documentation
fixes, UML related cleanups, and a feature to enable/disable KUnit
tests. This update includes the following change to
- rename all_test_uml.config, use it for --alltests
Note: if anyone was using all_tests_uml.config, this change breaks them.
This change simplifies the usage and eliminates the need to type:
--kunitconfig=tools/testing/kunit/configs/all_tests_uml.config.
A simple workaround to create a symlink to the new name can solve the
problem for anyone using all_tests_uml.config.
all_tests_uml.config should work across ~all architectures.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit f76349cf41451c5c42a99f18a9163377e4b364ff:
Linux 6.0-rc7 (2022-09-25 14:01:02 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-kunit-6.1-rc1
for you to fetch changes up to 4e37057387cca749b7fbc8c77e3d86605117fffd:
Documentation: Kunit: Use full path to .kunitconfig (2022-09-30 13:23:06 -0600)
----------------------------------------------------------------
linux-kselftest-kunit-6.1-rc1
This KUnit update for Linux 6.1-rc1 consists of several documentation
fixes, UML related cleanups, and a feature to enable/disable KUnit
tests. This update includes the following change to
- rename all_test_uml.config, use it for --alltests
Note: if anyone was using all_tests_uml.config, this change breaks them.
This change simplifies the usage and eliminates the need to type:
--kunitconfig=tools/testing/kunit/configs/all_tests_uml.config.
A simple workaround to create a symlink to the new name can solve the
problem for anyone using all_tests_uml.config.
all_tests_uml.config should work across ~all architectures.
----------------------------------------------------------------
Daniel Latypov (3):
kunit: tool: make --raw_output=kunit (aka --raw_output) preserve leading spaces
kunit: tool: remove UML specific options from all_tests_uml.config
kunit: tool: rename all_test_uml.config, use it for --alltests
Joe Fradley (2):
kunit: add kunit.enable to enable/disable KUnit test
kunit: no longer call module_info(test, "Y") for kunit modules
Khalid Masum (1):
Documentation: Kunit: Use full path to .kunitconfig
Tales Aparecida (12):
Documentation: kunit: fix trivial typo
Documentation: Kunit: Fix inconsistent titles
Documentation: KUnit: Fix non-uml anchor
Documentation: Kunit: Add ref for other kinds of tests
Documentation: KUnit: remove duplicated docs for kunit_tool
Documentation: KUnit: avoid repeating "kunit.py run" in start.rst
Documentation: KUnit: add note about mrproper in start.rst
Documentation: KUnit: Reword start guide for selecting tests
Documentation: KUnit: add intro to the getting-started page
Documentation: KUnit: update links in the index page
lib: overflow: update reference to kunit-tool
lib: stackinit: update reference to kunit-tool
Documentation/admin-guide/kernel-parameters.txt | 6 +
Documentation/dev-tools/kunit/architecture.rst | 4 +-
Documentation/dev-tools/kunit/faq.rst | 8 +-
Documentation/dev-tools/kunit/index.rst | 18 +-
Documentation/dev-tools/kunit/kunit-tool.rst | 232 ---------------------
Documentation/dev-tools/kunit/run_wrapper.rst | 38 ++--
Documentation/dev-tools/kunit/start.rst | 138 ++++++++----
Documentation/dev-tools/kunit/usage.rst | 4 +-
include/kunit/test.h | 3 +-
lib/kunit/Kconfig | 11 +
lib/kunit/executor.c | 4 +
lib/kunit/test.c | 24 +++
lib/overflow_kunit.c | 2 +-
lib/stackinit_kunit.c | 2 +-
.../{all_tests_uml.config => all_tests.config} | 2 -
tools/testing/kunit/configs/broken_on_uml.config | 44 ----
tools/testing/kunit/kunit.py | 26 +--
tools/testing/kunit/kunit_kernel.py | 30 +--
tools/testing/kunit/kunit_parser.py | 10 +-
tools/testing/kunit/kunit_tool_test.py | 26 ++-
20 files changed, 220 insertions(+), 412 deletions(-)
delete mode 100644 Documentation/dev-tools/kunit/kunit-tool.rst
rename tools/testing/kunit/configs/{all_tests_uml.config => all_tests.config} (93%)
delete mode 100644 tools/testing/kunit/configs/broken_on_uml.config
----------------------------------------------------------------
Hi Linus,
Please pull the following Kselftest update for Linux 6.1-rc1.
This Kselftest update for Linux 6.1-rc1 consists of fixes and new tests.
- Adds a amd-pstate-ut test module, this module is used by kselftest
to unit test amd-pstate functionality
- Fixes and cleanups to to cpu-hotplug to delete the fault injection
test code
- Improvements to vm test to use top_srcdir for builds
Please note that this update touches drivers/cpufreq to add a new test
module, a new header file to include/linux.
There are two conflicts with pm and mm trees: Stephen fixed these up in
linux-next.
1. A conflict in: tools/testing/selftests/vm/hmm-tests.c
between commit:
ab7039dbcc61 ("selftests/vm: use top_srcdir instead of recomputing relative paths")
from the kselftest tree and commit:
223e3150a0d8 ("hmm-tests: fix migrate_dirty_page test")
from the mm tree.
2. A conflict in:
drivers/cpufreq/amd-pstate.c
between commit:
d8bee41db83e ("cpufreq: amd-pstate: fix white-space")
from the pm tree and commit:
8c766b24ee62 ("cpufreq: amd-pstate: Expose struct amd_cpudata")
from the kselftest tree.
diff for this pull request is attached
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 568035b01cfb107af8d2e4bd2fb9aea22cf5b868:
Linux 6.0-rc1 (2022-08-14 15:50:18 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-next-6.1-rc1
for you to fetch changes up to 83e14a57d59f22a89ad7d59752f5b69189299531:
docs:kselftest: fix kselftest_module.h path of example module (2022-10-05 11:05:18 -0600)
----------------------------------------------------------------
linux-kselftest-next-6.1-rc1
This Kselftest update for Linux 6.1-rc1 consists of fixes and new tests.
- Adds a amd-pstate-ut test module, this module is used by kselftest
to unit test amd-pstate functionality
- Fixes and cleanups to to cpu-hotplug to delete the fault injection
test code
- Improvements to vm test to use top_srcdir for builds
----------------------------------------------------------------
Axel Rasmussen (1):
selftests/vm: use top_srcdir instead of recomputing relative paths
Hoi Pok Wu (1):
docs:kselftest: fix kselftest_module.h path of example module
Meng Li (6):
cpufreq: amd-pstate: Expose struct amd_cpudata
cpufreq: amd-pstate: Add test module for amd-pstate driver
selftests: amd-pstate: Add test trigger for amd-pstate driver
Documentation: amd-pstate: Add unit test introduction
cpufreq: amd-pstate: modify type in argument 2 for filp_open
cpufreq: amd-pstate: Add explanation for X86_AMD_PSTATE_UT
Zhao Gongyi (5):
selftests/cpu-hotplug: Correct log info
selftests/cpu-hotplug: Use return instead of exit
selftests/cpu-hotplug: Delete fault injection related code
selftests/cpu-hotplug: Reserve one cpu online at least
selftests/cpu-hotplug: Add log info when test success
Documentation/admin-guide/pm/amd-pstate.rst | 76 ++++++
Documentation/dev-tools/kselftest.rst | 2 +-
MAINTAINERS | 1 +
drivers/cpufreq/Kconfig.x86 | 15 ++
drivers/cpufreq/Makefile | 1 +
drivers/cpufreq/amd-pstate-ut.c | 293 +++++++++++++++++++++
drivers/cpufreq/amd-pstate.c | 60 +----
include/linux/amd-pstate.h | 77 ++++++
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/amd-pstate/Makefile | 9 +
.../testing/selftests/amd-pstate/amd-pstate-ut.sh | 56 ++++
tools/testing/selftests/amd-pstate/config | 1 +
tools/testing/selftests/cpu-hotplug/Makefile | 2 +-
tools/testing/selftests/cpu-hotplug/config | 1 -
.../selftests/cpu-hotplug/cpu-on-off-test.sh | 140 +++-------
tools/testing/selftests/vm/Makefile | 2 +-
tools/testing/selftests/vm/gup_test.c | 2 +-
tools/testing/selftests/vm/hmm-tests.c | 4 +-
tools/testing/selftests/vm/ksm_tests.c | 2 +-
19 files changed, 574 insertions(+), 171 deletions(-)
create mode 100644 drivers/cpufreq/amd-pstate-ut.c
create mode 100644 include/linux/amd-pstate.h
create mode 100644 tools/testing/selftests/amd-pstate/Makefile
create mode 100755 tools/testing/selftests/amd-pstate/amd-pstate-ut.sh
create mode 100644 tools/testing/selftests/amd-pstate/config
delete mode 100644 tools/testing/selftests/cpu-hotplug/config
----------------------------------------------------------------
Rework the ucall infrastructure to use a pool of ucall structs to pass
memory instead of using the guest's stack. For confidential VMs with
encrypted memory, e.g. SEV, the guest's stack "needs" to be private memory
and so can't be used to communicate with the host.
Convert all implementations to the pool as all of the complexity is hidden
in common code, and supporting multiple interfaces adds its own kind of
complexity.
v6:
- Collect tags. [Andrew, Peter]
- Drop an unnecessary NULL check on in_use. [Andrew]
v5:
- Use less convoluted method of writing per-VM "globals". [Oliver]
- Add patch to drop ucall_uninit().
v4: https://lore.kernel.org/all/20220824032115.3563686-1-seanjc@google.com
Peter Gonda (2):
tools: Add atomic_test_and_set_bit()
KVM: selftests: Add ucall pool based implementation
Sean Christopherson (5):
KVM: selftests: Consolidate common code for populating ucall struct
KVM: selftests: Consolidate boilerplate code in get_ucall()
KVM: selftests: Automatically do init_ucall() for non-barebones VMs
KVM: selftests: Make arm64's MMIO ucall multi-VM friendly
KVM: selftest: Drop now-unnecessary ucall_uninit()
tools/arch/x86/include/asm/atomic.h | 7 ++
tools/include/asm-generic/atomic-gcc.h | 12 ++
tools/testing/selftests/kvm/Makefile | 1 +
.../selftests/kvm/aarch64/arch_timer.c | 1 -
.../selftests/kvm/aarch64/debug-exceptions.c | 1 -
.../selftests/kvm/aarch64/hypercalls.c | 1 -
.../testing/selftests/kvm/aarch64/psci_test.c | 1 -
.../testing/selftests/kvm/aarch64/vgic_init.c | 2 -
.../testing/selftests/kvm/aarch64/vgic_irq.c | 1 -
tools/testing/selftests/kvm/dirty_log_test.c | 3 -
.../selftests/kvm/include/kvm_util_base.h | 15 +++
.../selftests/kvm/include/ucall_common.h | 10 +-
.../selftests/kvm/kvm_page_table_test.c | 2 -
.../testing/selftests/kvm/lib/aarch64/ucall.c | 102 +++--------------
tools/testing/selftests/kvm/lib/kvm_util.c | 11 ++
.../selftests/kvm/lib/perf_test_util.c | 3 -
tools/testing/selftests/kvm/lib/riscv/ucall.c | 42 +------
tools/testing/selftests/kvm/lib/s390x/ucall.c | 39 +------
.../testing/selftests/kvm/lib/ucall_common.c | 103 ++++++++++++++++++
.../testing/selftests/kvm/lib/x86_64/ucall.c | 39 +------
.../testing/selftests/kvm/memslot_perf_test.c | 1 -
tools/testing/selftests/kvm/rseq_test.c | 1 -
tools/testing/selftests/kvm/steal_time.c | 1 -
.../kvm/system_counter_offset_test.c | 1 -
24 files changed, 190 insertions(+), 210 deletions(-)
create mode 100644 tools/testing/selftests/kvm/lib/ucall_common.c
base-commit: e18d6152ff0f41b7f01f9817372022df04e0d354
--
2.38.0.rc1.362.ged0d419d3c-goog
From: Roberto Sassu <roberto.sassu(a)huawei.com>
NOTE: resending with libbpf_get_fd_opts test added to deny list for s390x.
Add the _opts variant for bpf_*_get_fd_by_id() functions, to be able to
pass to the kernel more options, when requesting a fd of an eBPF object to
the kernel.
Pass the options through a newly introduced structure, bpf_get_fd_opts,
which currently contains open_flags (the other two members are for
compatibility and for padding).
open_flags allows the caller to request specific permissions to access a
map (e.g. read-only). This is useful for example in the situation where a
map is write-protected.
Besides patches 2-6, which introduce the new variants and the data
structure, patch 1 fixes the LIBBPF_1.0.0 declaration in libbpf.map.
Roberto Sassu (6):
libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map
libbpf: Define bpf_get_fd_opts and introduce
bpf_map_get_fd_by_id_opts()
libbpf: Introduce bpf_prog_get_fd_by_id_opts()
libbpf: Introduce bpf_btf_get_fd_by_id_opts()
libbpf: Introduce bpf_link_get_fd_by_id_opts()
selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id()
tools/lib/bpf/bpf.c | 47 +++++++++-
tools/lib/bpf/bpf.h | 16 ++++
tools/lib/bpf/libbpf.map | 6 +-
tools/testing/selftests/bpf/DENYLIST.s390x | 1 +
.../bpf/prog_tests/libbpf_get_fd_opts.c | 88 +++++++++++++++++++
.../bpf/progs/test_libbpf_get_fd_opts.c | 36 ++++++++
6 files changed, 189 insertions(+), 5 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_opts.c
create mode 100644 tools/testing/selftests/bpf/progs/test_libbpf_get_fd_opts.c
--
2.25.1