From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99FCBC433EF for ; Wed, 22 Sep 2021 14:12:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8841560F56 for ; Wed, 22 Sep 2021 14:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236087AbhIVOOW (ORCPT ); Wed, 22 Sep 2021 10:14:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:29755 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236021AbhIVOOO (ORCPT ); Wed, 22 Sep 2021 10:14:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632319964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rZMdBUFCcEro44m/VYQjrdo8tgcAaj3vpqrRJk30Xe4=; b=AfPwWbF8yLhbvlx4DgIh/0v6SBEVJG8wr1TRBpKZz9hAUT7+td02E7C1DbrWdaQwPNMfLq YkYJORZmIpKPKtsTaskMCRnc2MC9vhPV3HIa79JkkQtPf5vgmxfDI2ZlD/1+Q6X+N1Andl 7cCs11/Uek2WDmmT8VDNq2zCYNr75Mo= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3-UoQwqvx6MQi9oxLTL1MwcQ-1; Wed, 22 Sep 2021 10:12:43 -0400 X-MC-Unique: UoQwqvx6MQi9oxLTL1MwcQ-1 Received: by mail-ed1-f69.google.com with SMTP id n5-20020a05640206c500b003cf53f7cef2so3214576edy.12 for ; Wed, 22 Sep 2021 07:12:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rZMdBUFCcEro44m/VYQjrdo8tgcAaj3vpqrRJk30Xe4=; b=aH+Aqe/KM2uDKbcBB/rlBRgt2bcjifIc0DK8IenzORmu7YTcHCQ9YSYiu3NmAEdvoJ vnKfdfLghTUFee+BGlR5vq9bMwZ3pOB0fsziNhmvZIB6MZIMnOcHJdKYEjxLUXe6T6L2 AP9j14l+wBfrz2nei4n+N4OL9vRcfnuWe4Fgbk/zKq2b29NX+D0PiL82rHXdP1YSc+qo f9V8NvjJf7JjQA8FaA5Yj47OVGG6nojFRXxblmX/HkLlQOPt+GUYCSma6unC8XVjrJtI gcBk7m5BB/rw+95XriVXHn/HWhZP7P3u7GxMUGrWjXB2oUvymJK1/8nn2uEOBC1UGhdI IcVQ== X-Gm-Message-State: AOAM532wIWW5HRgjYKLFMU+W5LyOfkh1JYLtfnUCxuDdagr3DMI/r/SI wkyWHOnfdN0FpopHxR8MNBZ3XjG8WcwGRktgkrLzpZkJUwhtrsCY+4h11ljzY2h+ojGTnMajruf 94T0/AZJk5x7mgVKDn8QJjBu4 X-Received: by 2002:a17:906:b183:: with SMTP id w3mr41217081ejy.394.1632319961904; Wed, 22 Sep 2021 07:12:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDM/LAO92AMI8uC+ZsdL5tg3HWsAwfnbY471GXtr9Lv9ROvDMZHXi9azcQssuJ/zXZcmQ7Nw== X-Received: by 2002:a17:906:b183:: with SMTP id w3mr41217031ejy.394.1632319961680; Wed, 22 Sep 2021 07:12:41 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id n23sm393858edw.75.2021.09.22.07.12.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Sep 2021 07:12:41 -0700 (PDT) Subject: Re: [PATCH 0/5] KVM: rseq: Fix and a test for a KVM+rseq bug To: Sean Christopherson , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Thomas Bogendoerfer , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Oleg Nesterov , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , Mathieu Desnoyers , "Paul E. McKenney" , Boqun Feng , Shuah Khan Cc: Benjamin Herrenschmidt , Paul Mackerras , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, Peter Foley , Shakeel Butt , Ben Gardon References: <20210818001210.4073390-1-seanjc@google.com> From: Paolo Bonzini Message-ID: <430684f9-1b35-b6f1-f243-6298e892bc7a@redhat.com> Date: Wed, 22 Sep 2021 16:12:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210818001210.4073390-1-seanjc@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/08/21 02:12, Sean Christopherson wrote: > Patch 1 fixes a KVM+rseq bug where KVM's handling of TIF_NOTIFY_RESUME, > e.g. for task migration, clears the flag without informing rseq and leads > to stale data in userspace's rseq struct. > > Patch 2 is a cleanup to try and make future bugs less likely. It's also > a baby step towards moving and renaming tracehook_notify_resume() since > it has nothing to do with tracing. It kills me to not do the move/rename > as part of this series, but having a dedicated series/discussion seems > more appropriate given the sheer number of architectures that call > tracehook_notify_resume() and the lack of an obvious home for the code. > > Patch 3 is a fix/cleanup to stop overriding x86's unistd_{32,64}.h when > the include path (intentionally) omits tools' uapi headers. KVM's > selftests do exactly that so that they can pick up the uapi headers from > the installed kernel headers, and still use various tools/ headers that > mirror kernel code, e.g. linux/types.h. This allows the new test in > patch 4 to reference __NR_rseq without having to manually define it. > > Patch 4 is a regression test for the KVM+rseq bug. > > Patch 5 is a cleanup made possible by patch 3. > > > Sean Christopherson (5): > KVM: rseq: Update rseq when processing NOTIFY_RESUME on xfer to KVM > guest > entry: rseq: Call rseq_handle_notify_resume() in > tracehook_notify_resume() > tools: Move x86 syscall number fallbacks to .../uapi/ > KVM: selftests: Add a test for KVM_RUN+rseq to detect task migration > bugs > KVM: selftests: Remove __NR_userfaultfd syscall fallback > > arch/arm/kernel/signal.c | 1 - > arch/arm64/kernel/signal.c | 1 - > arch/csky/kernel/signal.c | 4 +- > arch/mips/kernel/signal.c | 4 +- > arch/powerpc/kernel/signal.c | 4 +- > arch/s390/kernel/signal.c | 1 - > include/linux/tracehook.h | 2 + > kernel/entry/common.c | 4 +- > kernel/rseq.c | 4 +- > .../x86/include/{ => uapi}/asm/unistd_32.h | 0 > .../x86/include/{ => uapi}/asm/unistd_64.h | 3 - > tools/testing/selftests/kvm/.gitignore | 1 + > tools/testing/selftests/kvm/Makefile | 3 + > tools/testing/selftests/kvm/rseq_test.c | 131 ++++++++++++++++++ > 14 files changed, 143 insertions(+), 20 deletions(-) > rename tools/arch/x86/include/{ => uapi}/asm/unistd_32.h (100%) > rename tools/arch/x86/include/{ => uapi}/asm/unistd_64.h (83%) > create mode 100644 tools/testing/selftests/kvm/rseq_test.c > Queued v3, thanks. I'll send it in a separate pull request to Linus since it touches stuff outside my usual turf. Thanks, Paolo