Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp61317lqd; Tue, 23 Apr 2024 14:49:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2El6ak8jHJjRUhqIqqJkJZjPEpILKCKQQkRE6H2pIbd5FeN96sI7rEUINyXID7vo96OPjKoLG8Bpz1pTCRM4XiAsQX2WTQXTcLGtAyA== X-Google-Smtp-Source: AGHT+IFmcbwQRbUcRd2slmTGkC9uX6EWNL825KdW0csbDskvpOuXW+AKeaBlhms35V0e02IJKPZz X-Received: by 2002:a05:6a20:3c91:b0:1a3:dc33:2e47 with SMTP id b17-20020a056a203c9100b001a3dc332e47mr841325pzj.4.1713908982763; Tue, 23 Apr 2024 14:49:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713908982; cv=pass; d=google.com; s=arc-20160816; b=aXS16xYyI/mdJiDuETJRDRLrwgskjDgpwLVSbGoGUM2fEJaGU9b7BOhs+PQSBZDw/f 5jOZbsZ3MPT+Fk++6M4h4FBuiZNNynLUbX0MJWra62JHzhvOkTSbOApblPWl/IRagIgA j5Zn0txH2JBwnxSL2t84XBtPglvfQ93BXNtErSUz9AfJwLADe/Mwh6fE5OEXcxtJ46up LzVtc79bVg7jwHrBEaJCrIbXBhHXuPLd9HkgW1tu6eGe5IukJXqindrnki2l3QnRZizS FUaD6tif1myM32wvFFLujSExIZUL0CYsXRhTm9USD/Lx9EzcC6AqezfNt8QpT2SaDFFp +raA== 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=U480bomknQkqybyCzO4J0bpvqYL9TETZBB5r+gmlD9E=; fh=6VzYBHObzPae+htX+AXzp6DWUIeH3GYQOhxVpHZe/UI=; b=eBxGu29zBvl+DZfv1Z95vLrVepB//XoR89hzzJ4m4of7vlLLZVIyEOZbQNFeL9haWZ mAHoNShLOUKidHn/Pgp+RCmlj8uKsBa5TicVq/5o+w/524kWOBT/D0ytVVaaafnmzt3Y fMXTI8++NeZPa1EbcBmDo4kY+oclgIG9pPu9sGx0ZnGUJ71/yZiy7MtDgj/oe6TOouYV B8wVX0/TnKbXPZS9donbEdEakE83vxhDB1S1iEq8uM5UXzpIdyPUWCSfGxJWvXNra8Sl 808ZAf6NiQjgm/eR9JelEj+VU0fYOzmH1xX2jAO9UYxiNQ/o7wkTcca82sPAITAMjRSp XOtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=n2V3xDRp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="VqWCn/9W"; 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-155915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155915-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a2-20020a630b42000000b005eb4d251435si10236898pgl.705.2024.04.23.14.49.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 14:49:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=n2V3xDRp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="VqWCn/9W"; 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-155915-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155915-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B2FD9B252F4 for ; Tue, 23 Apr 2024 21:19:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3B34143882; Tue, 23 Apr 2024 21:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="n2V3xDRp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VqWCn/9W" 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 C287E14387C for ; Tue, 23 Apr 2024 21:18:57 +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=1713907139; cv=none; b=X9yHnKUNBS146Doe+aJqDNVfDq3uoouOSaq7e/b0I4WSE8Vvs/fstC0NZvXinLSKBSoj3IrXBs242sPj0nEwJc2daV6BO44PtvrJGO2S37mVg5mGGaP0KkGCeifvGbzCNavj4in9hDgTlDXHE4PegVj6LRh+GdGHk7lNJ0Bv6Mw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713907139; c=relaxed/simple; bh=lQ5mz/3QF+FVbW6Cfu+b6iZSyuXyJkg85ruyQbmfF/k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=rLPMxJMUuj7Q5TiHxhHnvOzeiH3PmOZURjHwoUQv2cvZf5nug3/SGEkHIPushMLr6SGIwdJiylsi/ShyqWovQBWXUQNMQ8O+rbxpGz9rJCz77Mxu+ng0DI6GDuTGdi0fWAFUYORrU9h4LjxUbr/83ENIAyr8tOtknyAACj4N9dA= 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=n2V3xDRp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VqWCn/9W; 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=1713907134; 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=U480bomknQkqybyCzO4J0bpvqYL9TETZBB5r+gmlD9E=; b=n2V3xDRptp5ca229GRDuXFDrkDAMuNphD0RbBkEsRBOrdZ3IoCCnCsUMTuC3JGWKrjjOuw JOooF/PSbq7QyUaSaB53ASiVsOlByuxN8RnoKB5QEaN2Pb2sp4Z1Z0Jf2/+G61jqKNQNcc MIJd1364YA3hL3ztRJS+lEJP6gXylHNlisL1KSb0P9/8ZRmMyEFbJRu2WGY0+GKxPhq1qO o0dXbfUmT1i+HMFbskccY1wjam5juMd0vewcxSTWzUQA5TDOW6n/uBF/QIJE9rC4vXcgSn d1Puz7Vn9quEDxyB7z6lp34BhA3j2UjXYbcj+pypKRpKHAjS+F2WgCitVXZyNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713907134; 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=U480bomknQkqybyCzO4J0bpvqYL9TETZBB5r+gmlD9E=; b=VqWCn/9WpFA7UmkAXSC/5UDpSs42pO5g4B2z64w7XDLSiiQHkALvUluFS9pvczSWXlY4k6 luxxYxULG7bQ+VBQ== 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: <20240419110632.GA3198@redhat.com> References: <20240410164558.316665885@linutronix.de> <20240410165552.572304080@linutronix.de> <20240418163811.GA23440@redhat.com> <20240418181821.GA26239@redhat.com> <20240419110632.GA3198@redhat.com> Date: Tue, 23 Apr 2024 23:18:50 +0200 Message-ID: <87sezbu69x.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 Fri, Apr 19 2024 at 13:06, Oleg Nesterov wrote: > On 04/18, Oleg Nesterov wrote: >> But this is not simple, collect_signal() checks SIGQUEUE_PREALLOC exactly >> because (iiuc) we need to ensure that SI_TIMER didn't come from userspace. >> >> perhaps we should disallow SI_TIMER with _sys_private != 0 from userspace, >> I dunno... >> >> And I don't really understand the "not to be passed to user" comment in >> include/uapi/asm-generic/siginfo.h. copy_siginfo_to_user() just copies >> the whole kernel_siginfo. > > OK, si_sys_private is cleared in dequeue_signal() (or in posixtimer_rearm() > with this series). > > In the past SI_TIMER was defined as __SI_CODE(__SI_TIMER,-2), it was > 0, > so it could not come from userspace (see the info->si_code >= 0 check in > do_rt_sigqueueinfo). Duh. > Today SI_TIMER < 0. We could introduce SI_TIMER_KERNEL > 0 with the minimal > changes, but this can't help because the commit 66dd34ad31e59 allows to send > any siginfo to itself. Well that predates the __SI_CODE() removal. So I doubt it's required today, but what do I know about CRIU. > 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. 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. 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. sys_si_private seems to be excluded from being set from user space in compat mode, but in non-compat mode I can't find anything which prevents that. Let me stare more at this. Thanks, tglx