From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 5F76520DD51 for ; Sat, 4 Jul 2026 11:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783163388; cv=none; b=oltpLXqB4wupZ0+4L/ZOHBOtx7Ufv/mtwBQi2gJhPlyOnimtWVxkzPVcEexyjLeXU0kaKhiCkX+uD1U0QEhIUlgCHLUdhNAgrq5Ys0tr+qo/ZRpAIRQ/OziSI/rk8QTt/Ev4xx3/hYf/UQLV6QqV13Yv2wM418WdLFA0RDoeNPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783163388; c=relaxed/simple; bh=VllQxsxw2CBMFUsGHfIO5puqulKlGTXF4PUf5MN3jBM=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=EDeThh3oQVMuaXNaTZdK7uhkucvwW1oAMuecHff01t1zovSYIdQPCYOa49pJwKn6opeGqSe3K/Hvpp5mERIgslENhqtGVKtoGhSrzA178MEKtdZ0oE/HTBJQI5pN3DMVPqvgU9gr1w4RUqaD1EcnKUyhbDHXeOixBfRyqByP1TY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Ycgryf7T; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ycgryf7T" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783163386; 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; bh=dVFez4RwUkT6J3J2VriQTH5ckBu9bl/23oN15z6cD0k=; b=Ycgryf7TWxrVCDurfqFR79bqYxKKaAfUJub+zPQJuNmCoyYuB8jFPSSfuEa/TuwrJImOLi o0/zhuFBx6uU5eOHaIDfRnjyKw6jx+k8C24ANsLrvmMj1OsKLDjEBgY8KU4v70uZoQgZgF BcIq5wDowGwAHyn+0CTD3lBbVWFmHZI= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-bMDmLXJ_ORa5HZAV4EcM8w-1; Sat, 04 Jul 2026 07:09:42 -0400 X-MC-Unique: bMDmLXJ_ORa5HZAV4EcM8w-1 X-Mimecast-MFC-AGG-ID: bMDmLXJ_ORa5HZAV4EcM8w_1783163381 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1958E195608F; Sat, 4 Jul 2026 11:09:41 +0000 (UTC) Received: from fedora (unknown [10.44.32.112]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 02C0A1971EC1; Sat, 4 Jul 2026 11:09:37 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sat, 4 Jul 2026 13:09:40 +0200 (CEST) Date: Sat, 4 Jul 2026 13:09:36 +0200 From: Oleg Nesterov To: Thomas Gleixner , Frederic Weisbecker , Peter Zijlstra Cc: Wongi Lee , Jungwoo Lee , Anna-Maria Behnsen , linux-kernel@vger.kernel.org Subject: [PATCH] posix-cpu-timers: don't abuse lock_task_sighand() in handle_posix_cpu_timers() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 After the commit f90fff1e152d ("posix-cpu-timers: fix race between handle_posix_cpu_timers() and posix_cpu_timer_del()"), tsk->sighand is stable in handle_posix_cpu_timers(), so it can use the plain spin_lock_irqsave(&tsk->sighand->siglock). Signed-off-by: Oleg Nesterov --- kernel/time/posix-cpu-timers.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index a7d3e8229c4b..d73d31c7994f 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -1357,8 +1357,11 @@ static void handle_posix_cpu_timers(struct task_struct *tsk) unsigned long flags, start; LIST_HEAD(firing); - if (!lock_task_sighand(tsk, &flags)) - return; + /* + * tsk is current and ->sighand is stable, see the + * tsk->exit_state check in run_posix_cpu_timers() + */ + spin_lock_irqsave(&tsk->sighand->siglock, flags); do { /* @@ -1418,7 +1421,7 @@ static void handle_posix_cpu_timers(struct task_struct *tsk) * that gets the timer lock before we do will give it up and * spin until we've taken care of that timer below. */ - unlock_task_sighand(tsk, &flags); + spin_unlock_irqrestore(&tsk->sighand->siglock, flags); /* * Now that all the timers on our list have the firing flag, -- 2.52.0