Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4704746iob; Sun, 8 May 2022 22:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3vpZAwvzzR+AYYa/BJ+cG4e2cjyeSgVIaZksJWddT4mlUIiq0lHMUJ0c2Eo9cMPFjqtKO X-Received: by 2002:a17:902:748c:b0:15e:c104:e9ee with SMTP id h12-20020a170902748c00b0015ec104e9eemr14379027pll.29.1652074762935; Sun, 08 May 2022 22:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652074762; cv=none; d=google.com; s=arc-20160816; b=MDuNKerDZniV+WdR/xByzGEZx/zpBlZcO3DRBAnmED0ibhz/962tZMiYEx6hwOt2nx mOvAwFVBL1EzpomaTyz/MA23SA9ZRatbxBNpBH9bguAIwBd9mT+HkpHeQnZlPhcNAoaG Vne0lHbpGUscQj9UTB0PI2KzZ8nLPSZ93spc0D40BEaxXridf2QD47rIxbowdqbLT/lr sovBGCo2FJd/IiXz5RIqnmEvMtrWBaB3lUO/0rja53rS+IEBQAbWPiuUvaoZLIvvNJ7Q EJaEY1PEZ9y92aMUfvIBrQjYdQ7tLOhnbLymDqb+5iIVAfHVDgGO+Hs/yU+4P1Mq9evV 5GJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=eGIaI6FR4z9ZKAajKHVzAuOrHeyDOTq0yBE9J83Z0DM=; b=ExGRqZJVP+CMy6vUuTPq/ll8r0lppPjmkfIjpAwiuvhjvkks5WNXORpZIylp/nxCiG GBesSs07ek1AH/GpvKNr1r2h7MUEMw8L7HJ3sZXxkQGvYrgMG9MNJYhZlMUz/9oWTMXc AD0JCJjRmn3MpoYUd2E1EYHJIp+gcKjIWKRRqHjY5HPo50SXCK2qFZKHfRKpz+Ab+RPd 4qjurqM/Cr9l9/ZrOX97JPhotFAYXSFv2qCw2xCGYt8vFutrKRuC62gW4v0yz7ShrGM8 paNHs95rz+Cqg3aKPmSvE5K/Vhpr/JzTvsQ2qxTxCeI4lYdRjOfhrRWFLgudw3xhbH6/ i9lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BP8TefPh; dkim=neutral (no key) header.i=@linutronix.de header.b=pcMuIo9a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g26-20020a63201a000000b003863b74af82si13583303pgg.393.2022.05.08.22.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:39:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BP8TefPh; dkim=neutral (no key) header.i=@linutronix.de header.b=pcMuIo9a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 35503158D60; Sun, 8 May 2022 22:38:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243414AbiEFQSY (ORCPT + 99 others); Fri, 6 May 2022 12:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238954AbiEFQSW (ORCPT ); Fri, 6 May 2022 12:18:22 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D50FE0AC; Fri, 6 May 2022 09:14:39 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651853677; 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: in-reply-to:in-reply-to:references:references; bh=eGIaI6FR4z9ZKAajKHVzAuOrHeyDOTq0yBE9J83Z0DM=; b=BP8TefPhONS8kML5NOLtpqXmzambUy0GK8jRF4v5uGIa0Q+/JF67dmyIKUFDZXdtkdgEH3 gAIhBHABcrOC2He1B7b5Y7v73xCxBS1QCOPiUZhjc5BsFx/1mQksKoyoU4EwvNH7+h4aoz Bdq07PrVDHsH6ZEYlsN/pWktW+cUEYejiG3BdFq0bzOTbDXcFeG37Hs5/mJ034JuqT7+PV 3VKnqbSUd17z9NG8jDKj3nc5kv+pcwotIX+kChEH2NIVF828gwNWslAaUqeIUokFPXDJ5d GbN2LPaEKfDIabQrU9y03/pgCGy8JVUc125APHZoRU6jo7tzc4Oq+ThteyikYQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651853677; 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: in-reply-to:in-reply-to:references:references; bh=eGIaI6FR4z9ZKAajKHVzAuOrHeyDOTq0yBE9J83Z0DM=; b=pcMuIo9aq1DOq5bWbaoANP7IgoaUD36hkEleH8xagaT73ZawBHhxDCvKJEKK5auc97xb+k alDKkQkLUmqNSHAQ== To: Alexander Potapenko Cc: Alexander Viro , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev , Linux Memory Management List , Linux-Arch , LKML Subject: Re: [PATCH v3 28/46] kmsan: entry: handle register passing from uninstrumented code In-Reply-To: References: <20220426164315.625149-1-glider@google.com> <20220426164315.625149-29-glider@google.com> <87a6c6y7mg.ffs@tglx> <87y1zjlhmj.ffs@tglx> <878rrfiqyr.ffs@tglx> Date: Fri, 06 May 2022 18:14:36 +0200 Message-ID: <87k0ayhc43.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 06 2022 at 16:52, Alexander Potapenko wrote: > On Thu, May 5, 2022 at 11:56 PM Thomas Gleixner wrote: >> @@ -452,6 +455,7 @@ irqentry_state_t noinstr irqentry_nmi_en >> rcu_nmi_enter(); >> >> instrumentation_begin(); >> + unpoison(regs); >> trace_hardirqs_off_finish(); >> ftrace_nmi_enter(); >> instrumentation_end(); >> >> As I said: 4 places :) > > These four instances still do not look sufficient. > Right now I am seeing e.g. reports with the following stack trace: > > BUG: KMSAN: uninit-value in irqtime_account_process_tick+0x255/0x580 > kernel/sched/cputime.c:382 > irqtime_account_process_tick+0x255/0x580 kernel/sched/cputime.c:382 > account_process_tick+0x98/0x450 kernel/sched/cputime.c:476 > update_process_times+0xe4/0x3e0 kernel/time/timer.c:1786 > tick_sched_handle kernel/time/tick-sched.c:243 > tick_sched_timer+0x83e/0x9e0 kernel/time/tick-sched.c:1473 > __run_hrtimer+0x518/0xe50 kernel/time/hrtimer.c:1685 > __hrtimer_run_queues kernel/time/hrtimer.c:1749 > hrtimer_interrupt+0x838/0x15a0 kernel/time/hrtimer.c:1811 > local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1086 > __sysvec_apic_timer_interrupt+0x1ae/0x680 arch/x86/kernel/apic/apic.c:1103 > sysvec_apic_timer_interrupt+0x95/0xc0 arch/x86/kernel/apic/apic.c:1097 > ... > (uninit creation stack trace is irrelevant here, because it is some > random value from the stack) > > sysvec_apic_timer_interrupt() receives struct pt_regs from > uninstrumented code, so regs can be partially uninitialized. > They are not passed down the call stack directly, but are instead > saved by set_irq_regs() in sysvec_apic_timer_interrupt() and loaded by > get_irq_regs() in tick_sched_timer(). sysvec_apic_timer_interrupt() invokes irqentry_enter() _before_ set_irq_regs() and irqentry_enter() unpoisons @reg. Confused...