Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp145134lqd; Tue, 23 Apr 2024 18:49:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU62ksHOzlUZDYUTLTeW4b14QkGvZMUKwCtHBihdITTHoedOz89gKD23+/AKOlp63Fh0gaNcYXlLwT21gGUD9KEWQAnmrwkd/NYMaus2w== X-Google-Smtp-Source: AGHT+IHJTJDR33yDFWpTy59TWCfYB7D7EFOHLAqglSNHfU1sfjFZkShPcuH+fnua5MEshPOLDh0W X-Received: by 2002:a2e:7e12:0:b0:2dd:9d77:bd60 with SMTP id z18-20020a2e7e12000000b002dd9d77bd60mr472760ljc.52.1713923359091; Tue, 23 Apr 2024 18:49:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713923359; cv=pass; d=google.com; s=arc-20160816; b=rXPMfwr1brGzwQ3qQRl/Ffx0ADPjaCbx8JG+ZEo9OHFmp23nkOQllif7nxl9ddqXgv gopCipYSqshc+JuCDr8CXWtv7FJOlNPhOTdhIQ8dsBF/ED7CqkLjnaKQ8QsTB2iijeps ifBqezeSgVd0u+vNcU3I4T3Fad9gX5dLeun6JegdJm41NB+w+pNGEEjcEGqwN4diZRbo rtZIs2bdUHP13TEcWE3ta6H0ZvHC0xjO7C6h/qctO/ZWETOOrbQZMvpdcvMUB9ZMEmgK nQsUk55VP209WYMjUUHZE3VrOMetugImqGHNg41RWqLPv9+1KkZos/VQCxdkFmpS4FC+ /3cA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=F5zHfMiON8HFmLdW6+ELVSBVklR/odVfqVLnZps4L9s=; fh=6VzYBHObzPae+htX+AXzp6DWUIeH3GYQOhxVpHZe/UI=; b=z31n46d0kvObYFKalLyhZDy1+qRmYmlxrQwqkBxhpt78kKHzjWkez+nOWh3h7N0YVH SNq4bNeOVJHr9EZ+ryjN3DeQWbUIKHMxmYEOjcpfmGccKbGPQKBNsKMednPvOfG4HeUE b04Xe4Z3apCJp2NWxpTC1TtsFWbmdwHCIe6rc7USmzrvGrIkUazkzv8wqx6P8PlwZy1n +sGW6WOWOE4Ek+yoLzmU81oURTMmMIT4co9YB4s5Tiipx00xDODrPgPvXMVPEKRKKtmX AZxohQTuOy06vTheG5u3CALEHF4ubL4z5PvnKNI2D6RZ6+LZpNJ4i+b3Q6wmnpAar2R2 VnTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cIIK77qv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-156104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y10-20020a056402358a00b005721214c6f0si2702463edc.575.2024.04.23.18.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 18:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cIIK77qv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-156104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CBB461F23A3B for ; Wed, 24 Apr 2024 01:49:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9ADA518E11; Wed, 24 Apr 2024 01:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cIIK77qv"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MCa8Nam7" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51F2F17C6D for ; Wed, 24 Apr 2024 01:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713923339; cv=none; b=FPSVGNDdGoiuTECx7ulgL40HTSRYcJ8gKr71JSW9/04cdhqw9vo373U3wJBMooH8ghkxUqnDiLxry6nmrRIzkI0+298M4bTFm52b84C6sr3x6f8btoy+jTB9EJOecbABeshDJ1PAKu5LBgeCESeQ7xjkxS2Pk8RDMYAvF4/2PRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713923339; c=relaxed/simple; bh=giMktJ71EARmlqXkvxyPyld7ZV/A3U4DTXZa/d46F1s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=PX1UNAEYB6ZrTerCT0oRZx2YC30Rv0ZqdYi133dbof6E+NW/f1Y+p7N6Ua30XWV53kMo7kc4TR3FwzllI5RiFj272wG4dhaIaoltnRdvaRTeTL79oeuJ8qs2gmJUbPQgsaCa+4I+jUEwuGa8hP+YmOhhkt7zfXw6MN8iYxs+X6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cIIK77qv; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=MCa8Nam7; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713923336; 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=F5zHfMiON8HFmLdW6+ELVSBVklR/odVfqVLnZps4L9s=; b=cIIK77qvYJfGCVTS8RxquL/s2q9Na4XPv7eZwPCzX2h1tGYISXKizpdg+3pBceBh4sD1DI xhBaXmf87+xArjdMN9dSrTPvA7yg3G3OzyNKF027U+pYgCsjqcyyk9ZedWyLhkpKpsZyhM rogm7qBxszzWnc5QMoglFSm4Ix755dQnqnWW0xeCnNHI5DgzOVoNXndKySAx6QGTxJAda3 RxjIprmZxodxAcXM1BNGcRh9jUCum5aWSj5nSvLdpY8JV2//Swt0zSptlMqy6WwDvw+N5c gtA2F563nf4A7Gjhr6LeuFXdooi6OJdgMCUcu/Ua77Cdp6eB9W0eEbcduivWjQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713923336; 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=F5zHfMiON8HFmLdW6+ELVSBVklR/odVfqVLnZps4L9s=; b=MCa8Nam78NdyKjrcW4PuyoPaHpoeontl9QaAvrRnPrfD6vBl9j72+bWGklLyB9StRL5FKh zDQvmnpXaKmaCWAA== To: Oleg Nesterov Cc: LKML , Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Andrei Vagin Subject: Re: [patch V2 26/50] signal: Get rid of resched_timer logic In-Reply-To: <87sezbu69x.ffs@tglx> References: <20240410164558.316665885@linutronix.de> <20240410165552.572304080@linutronix.de> <20240418163811.GA23440@redhat.com> <20240418181821.GA26239@redhat.com> <20240419110632.GA3198@redhat.com> <87sezbu69x.ffs@tglx> Date: Wed, 24 Apr 2024 03:48:53 +0200 Message-ID: <87plufttru.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, Apr 23 2024 at 23:18, Thomas Gleixner wrote: > On Fri, Apr 19 2024 at 13:06, Oleg Nesterov wrote: >> Otoh, I have no idea how CRIU restores the posix timers. If a process has >> a pending blocked SI_TIMER signal, then I guess it actually needs to enqueue >> this signal at restore time, but resched_timer will be never true? > > It can't restore the correct sys_si_private value because that is > nowhere exposed to user space. It is exposed via PTRACE_PEEKSIGINFO, but it's useless. > There is no special treatment for SI_TIMER, so the signal restore might > just end up queueing a random extra SI_TIMER signal if there was one > pending. It does. The sys_si_private value is not going to match the timer side value and obviously the missing prealloc flag prevents it from trying to rearm the timer. > I checked the CRIU source and it looks like this just "works" by > reconstructing and rearming the timer with the last expiry value. As > that is in the past it will fire immediately and queue the signal. It's not necessarily in the past, but it will fire eventually and in the case of a blocked signal there will be two SI_TIMER signals queued. So the patch is not completely wrong except that there is nothing which prevents setting sys_si_private via rt_sigqueueinfo(), but that's obviously a solvable problem. With that solved the condition: *resched_timer = (first->flags & SIGQUEUE_PREALLOC) && (info->si_code == SI_TIMER) && (info->si_sys_private); really can be reduced to: info->code == SI_TIMER && info->si_sys_private In fact it makes a lot of sense _not_ to allow user space to set info->si_sys_private because that's a kernel internal value and should never be exposed to user space in the first place. Let me look what it needs or if this can be solved slightly differently.