1. 06 10月, 2022 8 次提交
  2. 03 10月, 2022 1 次提交
  3. 01 10月, 2022 3 次提交
  4. 30 9月, 2022 9 次提交
    • S
      KVM: selftests: Compare insn opcodes directly in fix_hypercall_test · 39426507
      Sean Christopherson 提交于
      Directly compare the expected versus observed hypercall instructions when
      verifying that KVM patched in the native hypercall (FIX_HYPERCALL_INSN
      quirk enabled).  gcc rightly complains that doing a 4-byte memcpy() with
      an "unsigned char" as the source generates an out-of-bounds accesses.
      
      Alternatively, "exp" and "obs" could be declared as 3-byte arrays, but
      there's no known reason to copy locally instead of comparing directly.
      
      In function ‘assert_hypercall_insn’,
          inlined from ‘guest_main’ at x86_64/fix_hypercall_test.c:91:2:
      x86_64/fix_hypercall_test.c:63:9: error: array subscript ‘unsigned int[0]’
       is partly outside array bounds of ‘unsigned char[1]’ [-Werror=array-bounds]
         63 |         memcpy(&exp, exp_insn, sizeof(exp));
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      x86_64/fix_hypercall_test.c: In function ‘guest_main’:
      x86_64/fix_hypercall_test.c:42:22: note: object ‘vmx_hypercall_insn’ of size 1
         42 | extern unsigned char vmx_hypercall_insn;
            |                      ^~~~~~~~~~~~~~~~~~
      x86_64/fix_hypercall_test.c:25:22: note: object ‘svm_hypercall_insn’ of size 1
         25 | extern unsigned char svm_hypercall_insn;
            |                      ^~~~~~~~~~~~~~~~~~
      In function ‘assert_hypercall_insn’,
          inlined from ‘guest_main’ at x86_64/fix_hypercall_test.c:91:2:
      x86_64/fix_hypercall_test.c:64:9: error: array subscript ‘unsigned int[0]’
       is partly outside array bounds of ‘unsigned char[1]’ [-Werror=array-bounds]
         64 |         memcpy(&obs, obs_insn, sizeof(obs));
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      x86_64/fix_hypercall_test.c: In function ‘guest_main’:
      x86_64/fix_hypercall_test.c:25:22: note: object ‘svm_hypercall_insn’ of size 1
         25 | extern unsigned char svm_hypercall_insn;
            |                      ^~~~~~~~~~~~~~~~~~
      x86_64/fix_hypercall_test.c:42:22: note: object ‘vmx_hypercall_insn’ of size 1
         42 | extern unsigned char vmx_hypercall_insn;
            |                      ^~~~~~~~~~~~~~~~~~
      cc1: all warnings being treated as errors
      make: *** [../lib.mk:135: tools/testing/selftests/kvm/x86_64/fix_hypercall_test] Error 1
      
      Fixes: 6c2fa8b2 ("selftests: KVM: Test KVM_X86_QUIRK_FIX_HYPERCALL_INSN")
      Cc: Oliver Upton <oliver.upton@linux.dev>
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Reviewed-by: NOliver Upton <oliver.upton@linux.dev>
      Message-Id: <20220928233652.783504-3-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      39426507
    • S
      KVM: selftests: Implement memcmp(), memcpy(), and memset() for guest use · 6b6f7148
      Sean Christopherson 提交于
      Implement memcmp(), memcpy(), and memset() to override the compiler's
      built-in versions in order to guarantee that the compiler won't generate
      out-of-line calls to external functions via the PLT.  This allows the
      helpers to be safely used in guest code, as KVM selftests don't support
      dynamic loading of guest code.
      
      Steal the implementations from the kernel's generic versions, sans the
      optimizations in memcmp() for unaligned accesses.
      
      Put the utilities in a separate compilation unit and build with
      -ffreestanding to fudge around a gcc "feature" where it will optimize
      memset(), memcpy(), etc... by generating a recursive call.  I.e. the
      compiler optimizes itself into infinite recursion.  Alternatively, the
      individual functions could be tagged with
      optimize("no-tree-loop-distribute-patterns"), but using "optimize" for
      anything but debug is discouraged, and Linus NAK'd the use of the flag
      in the kernel proper[*].
      
      https://lore.kernel.org/lkml/CAHk-=wik-oXnUpfZ6Hw37uLykc-_P0Apyn2XuX-odh-3Nzop8w@mail.gmail.com
      
      Cc: Andrew Jones <andrew.jones@linux.dev>
      Cc: Anup Patel <anup@brainfault.org>
      Cc: Atish Patra <atishp@atishpatra.org>
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20220928233652.783504-2-seanjc@google.com>
      Reviewed-by: NAndrew Jones <andrew.jones@linux.dev>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6b6f7148
    • D
      KVM: selftests: Gracefully handle empty stack traces · 09636efd
      David Matlack 提交于
      Bail out of test_dump_stack() if the stack trace is empty rather than
      invoking addr2line with zero addresses. The problem with the latter is
      that addr2line will block waiting for addresses to be passed in via
      stdin, e.g. if running a selftest from an interactive terminal.
      
      Opportunistically fix up the comment that mentions skipping 3 frames
      since only 2 are skipped in the code.
      
      Cc: Vipin Sharma <vipinsh@google.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Signed-off-by: NDavid Matlack <dmatlack@google.com>
      Message-Id: <20220922231724.3560211-1-dmatlack@google.com>
      [Small tweak to keep backtrace() call close to if(). - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      09636efd
    • E
      KVM: selftests: replace assertion with warning in access_tracking_perf_test · 6336a810
      Emanuele Giuseppe Esposito 提交于
      Page_idle uses {ptep/pmdp}_clear_young_notify which in turn calls
      the mmu notifier callback ->clear_young(), which purposefully
      does not flush the TLB.
      
      When running the test in a nested guest, point 1. of the test
      doc header is violated, because KVM TLB is unbounded by size
      and since no flush is forced, KVM does not update the sptes
      accessed/idle bits resulting in guest assertion failure.
      
      More precisely, only the first ACCESS_WRITE in run_test() actually
      makes visible changes, because sptes are created and the accessed
      bit is set to 1 (or idle bit is 0). Then the first mark_memory_idle()
      passes since access bit is still one, and sets all pages as idle
      (or not accessed). When the next write is performed, the update
      is not flushed therefore idle is still 1 and next mark_memory_idle()
      fails.
      Signed-off-by: NEmanuele Giuseppe Esposito <eesposit@redhat.com>
      Message-Id: <20220926082923.299554-1-eesposit@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6336a810
    • M
      kselftest/arm64: Handle EINTR while reading data from children · a7119874
      Mark Brown 提交于
      Currently we treat any error when reading from the child as a failure and
      don't read any more output from that child as a result. This ignores the
      fact that it is valid for read() to return EINTR as the error code if there
      is a signal pending so we could stop handling the output of children,
      especially during exit when we will get some SIGCHLD signals delivered to
      us. Fix this by pulling the read handling out into a separate function
      which returns a flag if reads should be continued and wrapping it in a
      loop.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220921181345.618085-4-broonie@kernel.orgSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      a7119874
    • M
      kselftest/arm64: Flag fp-stress as exiting when we begin finishing up · dd72dd7c
      Mark Brown 提交于
      Once we have started exiting the termination handler will have the same
      effect as what we're already running so set the termination flag at that
      point.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220921181345.618085-3-broonie@kernel.orgSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      dd72dd7c
    • M
      kselftest/arm64: Don't repeat termination handler for fp-stress · c38d381f
      Mark Brown 提交于
      When fp-stress gets a termination signal it sets a flag telling itself to
      exit and sends a termination signal to all the children. If the flag is set
      then don't bother repeating this process, it isn't going to accomplish
      anything other than consume CPU time which can be an issue when running in
      emulation.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220921181345.618085-2-broonie@kernel.orgSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      c38d381f
    • M
      kselftest/arm64: Don't enable v8.5 for MTE selftest builds · 55c8a987
      Mark Brown 提交于
      Currently we set -march=armv8.5+memtag when building the MTE selftests,
      allowing the compiler to emit v8.5 and MTE instructions for anything it
      generates. This means that we may get code that will generate SIGILLs when
      run on older systems rather than skipping on non-MTE systems as should be
      the case. Most toolchains don't select any incompatible instructions but
      I have seen some reports which suggest that some may be appearing which do
      so. This is also potentially problematic in that if the compiler chooses to
      emit any MTE instructions for the C code it may interfere with the MTE
      usage we are trying to test.
      
      Since the only reason we are specifying this option is to allow us to
      assemble MTE instructions in mte_helper.S we can avoid these issues by
      moving to using a .arch directive there and adding the -march explicitly to
      the toolchain support check instead of the generic CFLAGS.
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220928154517.173108-1-broonie@kernel.orgSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      55c8a987
    • M
      selftests/bpf: Check -EBUSY for the recurred bpf_setsockopt(TCP_CONGESTION) · 3411c5b6
      Martin KaFai Lau 提交于
      This patch changes the bpf_dctcp test to ensure the recurred
      bpf_setsockopt(TCP_CONGESTION) returns -EBUSY.
      Signed-off-by: NMartin KaFai Lau <martin.lau@kernel.org>
      Link: https://lore.kernel.org/r/20220929070407.965581-6-martin.lau@linux.devSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
      3411c5b6
  5. 29 9月, 2022 12 次提交
  6. 28 9月, 2022 7 次提交