Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1327219rwl; Fri, 7 Apr 2023 14:01:00 -0700 (PDT) X-Google-Smtp-Source: AKy350alqnLrQJ0NM+uMnmLoFsx5G0xhVGVlK82g9hEE4855mtXi9zavVXZtrDTuENM+w6M+zaDd X-Received: by 2002:aa7:96cf:0:b0:62d:b9f6:88bc with SMTP id h15-20020aa796cf000000b0062db9f688bcmr3720732pfq.32.1680901260027; Fri, 07 Apr 2023 14:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680901260; cv=none; d=google.com; s=arc-20160816; b=Qb1biH1qyY8ul2pqnXIhezlEWCdbOQ6Dk4kTTS/wUCU2hdVw3UMjfFeMyb6nR0dQPU vWMTAeWVzPqii+PIVwAICPJdx4VQ32EF1CxFi3wbRdpd6XpuIyJE8ygq0wwl5dpgjQXO hSKWk5q0FPJHmbBXxXri+Y7BLMTNcxrhQ75wVhDBMt2Yrn04CLbtIRk7nrsDEvzG5Bpb j6557CxievocVJOGJKaLgHR8hIgOU/ilmxrbBFiC9PGnnkk8TRUuxXBKK4IGv4hkujuR hhr0DHEm9NVCWQFidwPSm7w8U6WPMIPjPbVKxwTFAZEDQ0uQX8jGrhJpJqlSDujahNao nv2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KeL0ChRHAkTwILIIUOEWhFIIrLB8JOfL+XEMLJiQuZw=; b=YsHXk5HLlXw+kX4rjldb+VfayO+1mdkFNrxYHz1wFrsvnLej1rRU+GDDTo4ZBHgqNE TZY0cDUFvBhBDt7UOgW3uLrf+hS2DA+8CsX4J82EiA51+La2cGppK80a8teDKqcAzsfH 2DE8GiSKo6ESMohxpPm4K9GIxNpUZvIM6QOCK0U/aLnT0VFBnhQlmuGR5+g9wDtGU3zZ XeYDLjURgxkxLJV4m2vpZl7uQdiiqfj/J8rPvErIyRs9C9MaP72/uBSydraD5axs3//7 iVkzzDe1Rykbf9A/k6vfCxp0HUI/vgK7DqN86xZXFPL0e0mCI+UQOeOCDDaRCbOvG0lb gSlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ji09rthd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z25-20020aa79599000000b00624c3ad6c03si4322293pfj.227.2023.04.07.14.00.44; Fri, 07 Apr 2023 14:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ji09rthd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbjDGVAi (ORCPT + 99 others); Fri, 7 Apr 2023 17:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjDGVAh (ORCPT ); Fri, 7 Apr 2023 17:00:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 997D8199B for ; Fri, 7 Apr 2023 14:00:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34D8E651CA for ; Fri, 7 Apr 2023 21:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3986EC433D2; Fri, 7 Apr 2023 21:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680901235; bh=NG9cVPo8jYKrgpxNTOWvWnfRF3Zeu8y+oexjDO79R7c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ji09rthdzminTO655oWSPyu9AOv9VJGdc9qkH42nxaQU0HHZ4FnknDYVWBG5KsMSm /6002nlAwZ4Ti2BA1BSmAwTJrKfdyAmDiK7dOdKU87ES1THS5kJmWJ+iEsSAglSAhm i9+lVEMJb8z+mxIA47qYODiMVCNBWQhYo+VTQD5w7LHA6DCcctbhjMJ3jW3y0pfoF1 F1ER3qEObJUw3lVItGkneltZ160gYEpU8d+ZsajEGenJUvwpNJBBNFtT97GQqbDn29 6CNOig7iKa4eNjfTeZeDJckY9ijavFZmSNILXgoxJwfnDOzhbWBI302g5pYgUR9hxi /nCD1fCwOeUOA== Date: Fri, 7 Apr 2023 23:00:32 +0200 From: Frederic Weisbecker To: Thomas Gleixner Cc: Marco Elver , syzbot , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Anna-Maria Behnsen , Jacob Keller , "Paul E. McKenney" , Peter Zijlstra Subject: Re: WARNING in timer_wait_running Message-ID: References: <87h6tsred7.ffs@tglx> <874jpsqdy1.ffs@tglx> <87lej3twhv.ffs@tglx> <87ile7trv7.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87ile7trv7.ffs@tglx> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Le Fri, Apr 07, 2023 at 09:27:40PM +0200, Thomas Gleixner a ?crit : > On Fri, Apr 07 2023 at 20:36, Frederic Weisbecker wrote: > > > On Fri, Apr 07, 2023 at 07:47:40PM +0200, Thomas Gleixner wrote: > >> On Fri, Apr 07 2023 at 13:50, Frederic Weisbecker wrote: > >> > On Fri, Apr 07, 2023 at 10:44:22AM +0200, Thomas Gleixner wrote: > >> >> Now memory came back. The problem with posix CPU timers is that it is > >> >> not really known to the other side which task is actually doing the > >> >> expiry. For process wide timers this could be any task in the process. > >> >> > >> >> For hrtimers this works because the expiring context is known. > >> > > >> > So if posix_cpu_timer_del() were to clear ctmr->pid to NULL and then > >> > delay put_pid() with RCU, we could retrieve that information without > >> > holding the timer lock (with appropriate RCU accesses all around). > >> > >> No, you can't. This only gives you the process, but the expiry might run > >> on any task of that. To make that work you need a mutex in sighand. > > > > Duh right missed that. Ok will try. > > But that's nasty as well as this can race against exec/exit and you can't > hold sighand lock when acquiring the mutex. > > The mutex needs to be per task and held by the task which runs the > expiry task work. > > Something like the completely untested below. You get the idea though. For something untested, it looks quite right! Thanks.