Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c commit077cdda764("net/mlx5e: TC, Fix memory leak with rules with internal port") commit31108d142f("net/mlx5: Fix some error handling paths in 'mlx5e_tc_add_fdb_flow()'") commit4390c6edc0("net/mlx5: Fix some error handling paths in 'mlx5e_tc_add_fdb_flow()'") https://lore.kernel.org/all/20211229065352.30178-1-saeed@kernel.org/ net/smc/smc_wr.c commit49dc9013e3("net/smc: Use the bitmap API when applicable") commit349d43127d("net/smc: fix kernel panic caused by race of smc_sock") bitmap_zero()/memset() is removed by the fix Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
1
tools/testing/selftests/kvm/.gitignore
vendored
1
tools/testing/selftests/kvm/.gitignore
vendored
@@ -35,6 +35,7 @@
|
||||
/x86_64/vmx_apic_access_test
|
||||
/x86_64/vmx_close_while_nested_test
|
||||
/x86_64/vmx_dirty_log_test
|
||||
/x86_64/vmx_invalid_nested_guest_state
|
||||
/x86_64/vmx_preemption_timer_test
|
||||
/x86_64/vmx_set_nested_state_test
|
||||
/x86_64/vmx_tsc_adjust_test
|
||||
|
||||
@@ -64,6 +64,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_dirty_log_test
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_invalid_nested_guest_state
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_set_nested_state_test
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_tsc_adjust_test
|
||||
TEST_GEN_PROGS_x86_64 += x86_64/vmx_nested_tsc_scaling_test
|
||||
|
||||
@@ -71,15 +71,6 @@ enum vm_guest_mode {
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
unsigned long vm_compute_max_gfn(struct kvm_vm *vm);
|
||||
#else
|
||||
static inline unsigned long vm_compute_max_gfn(struct kvm_vm *vm)
|
||||
{
|
||||
return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MIN_PAGE_SIZE (1U << MIN_PAGE_SHIFT)
|
||||
#define PTES_PER_MIN_PAGE ptes_per_page(MIN_PAGE_SIZE)
|
||||
|
||||
@@ -330,6 +321,7 @@ bool vm_is_unrestricted_guest(struct kvm_vm *vm);
|
||||
|
||||
unsigned int vm_get_page_size(struct kvm_vm *vm);
|
||||
unsigned int vm_get_page_shift(struct kvm_vm *vm);
|
||||
unsigned long vm_compute_max_gfn(struct kvm_vm *vm);
|
||||
uint64_t vm_get_max_gfn(struct kvm_vm *vm);
|
||||
int vm_get_fd(struct kvm_vm *vm);
|
||||
|
||||
|
||||
@@ -2328,6 +2328,11 @@ unsigned int vm_get_page_shift(struct kvm_vm *vm)
|
||||
return vm->page_shift;
|
||||
}
|
||||
|
||||
unsigned long __attribute__((weak)) vm_compute_max_gfn(struct kvm_vm *vm)
|
||||
{
|
||||
return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1;
|
||||
}
|
||||
|
||||
uint64_t vm_get_max_gfn(struct kvm_vm *vm)
|
||||
{
|
||||
return vm->max_gfn;
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#include "test_util.h"
|
||||
#include "kvm_util.h"
|
||||
#include "processor.h"
|
||||
#include "vmx.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "kselftest.h"
|
||||
|
||||
#define VCPU_ID 0
|
||||
#define ARBITRARY_IO_PORT 0x2000
|
||||
|
||||
static struct kvm_vm *vm;
|
||||
|
||||
static void l2_guest_code(void)
|
||||
{
|
||||
/*
|
||||
* Generate an exit to L0 userspace, i.e. main(), via I/O to an
|
||||
* arbitrary port.
|
||||
*/
|
||||
asm volatile("inb %%dx, %%al"
|
||||
: : [port] "d" (ARBITRARY_IO_PORT) : "rax");
|
||||
}
|
||||
|
||||
static void l1_guest_code(struct vmx_pages *vmx_pages)
|
||||
{
|
||||
#define L2_GUEST_STACK_SIZE 64
|
||||
unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE];
|
||||
|
||||
GUEST_ASSERT(prepare_for_vmx_operation(vmx_pages));
|
||||
GUEST_ASSERT(load_vmcs(vmx_pages));
|
||||
|
||||
/* Prepare the VMCS for L2 execution. */
|
||||
prepare_vmcs(vmx_pages, l2_guest_code,
|
||||
&l2_guest_stack[L2_GUEST_STACK_SIZE]);
|
||||
|
||||
/*
|
||||
* L2 must be run without unrestricted guest, verify that the selftests
|
||||
* library hasn't enabled it. Because KVM selftests jump directly to
|
||||
* 64-bit mode, unrestricted guest support isn't required.
|
||||
*/
|
||||
GUEST_ASSERT(!(vmreadz(CPU_BASED_VM_EXEC_CONTROL) & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) ||
|
||||
!(vmreadz(SECONDARY_VM_EXEC_CONTROL) & SECONDARY_EXEC_UNRESTRICTED_GUEST));
|
||||
|
||||
GUEST_ASSERT(!vmlaunch());
|
||||
|
||||
/* L2 should triple fault after main() stuffs invalid guest state. */
|
||||
GUEST_ASSERT(vmreadz(VM_EXIT_REASON) == EXIT_REASON_TRIPLE_FAULT);
|
||||
GUEST_DONE();
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
vm_vaddr_t vmx_pages_gva;
|
||||
struct kvm_sregs sregs;
|
||||
struct kvm_run *run;
|
||||
struct ucall uc;
|
||||
|
||||
nested_vmx_check_supported();
|
||||
|
||||
vm = vm_create_default(VCPU_ID, 0, (void *) l1_guest_code);
|
||||
|
||||
/* Allocate VMX pages and shared descriptors (vmx_pages). */
|
||||
vcpu_alloc_vmx(vm, &vmx_pages_gva);
|
||||
vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_gva);
|
||||
|
||||
vcpu_run(vm, VCPU_ID);
|
||||
|
||||
run = vcpu_state(vm, VCPU_ID);
|
||||
|
||||
/*
|
||||
* The first exit to L0 userspace should be an I/O access from L2.
|
||||
* Running L1 should launch L2 without triggering an exit to userspace.
|
||||
*/
|
||||
TEST_ASSERT(run->exit_reason == KVM_EXIT_IO,
|
||||
"Expected KVM_EXIT_IO, got: %u (%s)\n",
|
||||
run->exit_reason, exit_reason_str(run->exit_reason));
|
||||
|
||||
TEST_ASSERT(run->io.port == ARBITRARY_IO_PORT,
|
||||
"Expected IN from port %d from L2, got port %d",
|
||||
ARBITRARY_IO_PORT, run->io.port);
|
||||
|
||||
/*
|
||||
* Stuff invalid guest state for L2 by making TR unusuable. The next
|
||||
* KVM_RUN should induce a TRIPLE_FAULT in L2 as KVM doesn't support
|
||||
* emulating invalid guest state for L2.
|
||||
*/
|
||||
memset(&sregs, 0, sizeof(sregs));
|
||||
vcpu_sregs_get(vm, VCPU_ID, &sregs);
|
||||
sregs.tr.unusable = 1;
|
||||
vcpu_sregs_set(vm, VCPU_ID, &sregs);
|
||||
|
||||
vcpu_run(vm, VCPU_ID);
|
||||
|
||||
switch (get_ucall(vm, VCPU_ID, &uc)) {
|
||||
case UCALL_DONE:
|
||||
break;
|
||||
case UCALL_ABORT:
|
||||
TEST_FAIL("%s", (const char *)uc.args[0]);
|
||||
default:
|
||||
TEST_FAIL("Unexpected ucall: %lu", uc.cmd);
|
||||
}
|
||||
}
|
||||
@@ -110,22 +110,5 @@ int main(int argc, char *argv[])
|
||||
ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, PMU_CAP_LBR_FMT);
|
||||
TEST_ASSERT(ret == 0, "Bad PERF_CAPABILITIES didn't fail.");
|
||||
|
||||
/* testcase 4, set capabilities when we don't have PDCM bit */
|
||||
entry_1_0->ecx &= ~X86_FEATURE_PDCM;
|
||||
vcpu_set_cpuid(vm, VCPU_ID, cpuid);
|
||||
ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, host_cap.capabilities);
|
||||
TEST_ASSERT(ret == 0, "Bad PERF_CAPABILITIES didn't fail.");
|
||||
|
||||
/* testcase 5, set capabilities when we don't have PMU version bits */
|
||||
entry_1_0->ecx |= X86_FEATURE_PDCM;
|
||||
eax.split.version_id = 0;
|
||||
entry_1_0->ecx = eax.full;
|
||||
vcpu_set_cpuid(vm, VCPU_ID, cpuid);
|
||||
ret = _vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, PMU_CAP_FW_WRITES);
|
||||
TEST_ASSERT(ret == 0, "Bad PERF_CAPABILITIES didn't fail.");
|
||||
|
||||
vcpu_set_msr(vm, 0, MSR_IA32_PERF_CAPABILITIES, 0);
|
||||
ASSERT_EQ(vcpu_get_msr(vm, VCPU_ID, MSR_IA32_PERF_CAPABILITIES), 0);
|
||||
|
||||
kvm_vm_free(vm);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ CONFIG_NETFILTER=y
|
||||
CONFIG_NETFILTER_ADVANCED=y
|
||||
CONFIG_NETFILTER_NETLINK=m
|
||||
CONFIG_NF_TABLES=m
|
||||
CONFIG_NFT_COUNTER=m
|
||||
CONFIG_NFT_COMPAT=m
|
||||
CONFIG_NETFILTER_XTABLES=m
|
||||
CONFIG_NETFILTER_XT_MATCH_BPF=m
|
||||
|
||||
@@ -132,7 +132,7 @@ run_test() {
|
||||
local rcv=`ip netns exec $NS_DST $ipt"-save" -c | grep 'dport 8000' | \
|
||||
sed -e 's/\[//' -e 's/:.*//'`
|
||||
if [ $rcv != $pkts ]; then
|
||||
echo " fail - received $rvs packets, expected $pkts"
|
||||
echo " fail - received $rcv packets, expected $pkts"
|
||||
ret=1
|
||||
return
|
||||
fi
|
||||
@@ -185,6 +185,7 @@ for family in 4 6; do
|
||||
IPT=iptables
|
||||
SUFFIX=24
|
||||
VXDEV=vxlan
|
||||
PING=ping
|
||||
|
||||
if [ $family = 6 ]; then
|
||||
BM_NET=$BM_NET_V6
|
||||
@@ -192,6 +193,7 @@ for family in 4 6; do
|
||||
SUFFIX="64 nodad"
|
||||
VXDEV=vxlan6
|
||||
IPT=ip6tables
|
||||
PING="ping6"
|
||||
fi
|
||||
|
||||
echo "IPv$family"
|
||||
@@ -237,7 +239,7 @@ for family in 4 6; do
|
||||
|
||||
# load arp cache before running the test to reduce the amount of
|
||||
# stray traffic on top of the UDP tunnel
|
||||
ip netns exec $NS_SRC ping -q -c 1 $OL_NET$DST_NAT >/dev/null
|
||||
ip netns exec $NS_SRC $PING -q -c 1 $OL_NET$DST_NAT >/dev/null
|
||||
run_test "GRO fwd over UDP tunnel" $OL_NET$DST_NAT 1 1 $OL_NET$DST
|
||||
cleanup
|
||||
|
||||
|
||||
@@ -156,13 +156,13 @@ struct testcase testcases_v4[] = {
|
||||
},
|
||||
{
|
||||
/* send max number of min sized segments */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
|
||||
.tlen = UDP_MAX_SEGMENTS,
|
||||
.gso_len = 1,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS,
|
||||
},
|
||||
{
|
||||
/* send max number + 1 of min sized segments: fail */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1,
|
||||
.tlen = UDP_MAX_SEGMENTS + 1,
|
||||
.gso_len = 1,
|
||||
.tfail = true,
|
||||
},
|
||||
@@ -259,13 +259,13 @@ struct testcase testcases_v6[] = {
|
||||
},
|
||||
{
|
||||
/* send max number of min sized segments */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
|
||||
.tlen = UDP_MAX_SEGMENTS,
|
||||
.gso_len = 1,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS,
|
||||
},
|
||||
{
|
||||
/* send max number + 1 of min sized segments: fail */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1,
|
||||
.tlen = UDP_MAX_SEGMENTS + 1,
|
||||
.gso_len = 1,
|
||||
.tfail = true,
|
||||
},
|
||||
|
||||
@@ -419,6 +419,7 @@ static void usage(const char *filepath)
|
||||
|
||||
static void parse_opts(int argc, char **argv)
|
||||
{
|
||||
const char *bind_addr = NULL;
|
||||
int max_len, hdrlen;
|
||||
int c;
|
||||
|
||||
@@ -446,7 +447,7 @@ static void parse_opts(int argc, char **argv)
|
||||
cfg_cpu = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'D':
|
||||
setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
|
||||
bind_addr = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
|
||||
@@ -492,6 +493,11 @@ static void parse_opts(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!bind_addr)
|
||||
bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
|
||||
|
||||
setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr);
|
||||
|
||||
if (optind != argc)
|
||||
usage(argv[0]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user