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.133.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 A6FEA2750ED for ; Sun, 5 Apr 2026 14:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775398866; cv=none; b=PngsMJLNGVN9IzrdpJ2+dG0X9j3OyJ97wu/MBoc+SFU3GTE5nLuTLbPQlMN5d68cLXRbytxVdukvh+pImEImJObSjU/JZolPFeV7sc2w+khfWXiVjbryFZr5sWcdu6fFI8e9iS3pTOYwq54nuxqe+JymZvO8LXyNh53feIzjl3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775398866; c=relaxed/simple; bh=R64NP6+t2ElJnAc750uZoNDSG6rnShIgvWBJnkh0RKk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OsVZTSuL0EQYWAo2T9p2cDuw0CewnZT6uS6q732ykTk9mZMoW++w5HpHKCWI0e6AwmugFsoglI3N0f36UHrqnR5wyT0gl736jeq/IN6ozOGK9Aiqy4RGSVMizYbGojdQBUzhST19ka581N0N+0E4gBP2GW59WviF8j8PWrX3m5w= 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=TDY7WKOY; arc=none smtp.client-ip=170.10.133.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="TDY7WKOY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775398863; 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=D6ueB8nyFgzUx8rIEvUlzemhFYFfrxAuBmXgE2LSeBM=; b=TDY7WKOYKv0NX+h2WN1ivJdPLEVMJa6kBcqjx6SA7WoAHr60HFJu/qWdBNJ5w58Rn6mE/J 9o2oBiIW/xkz7k4avKLz84tVnGfdkK9y2x3+1L4pcPxQCIzSRUpwK6BxKgm4/dCDOC0cyZ JrQn6/hRtqW0tSAJ62g4YD6vY/IV70I= 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-614--FTRA5o6OgCyAFH78Otdgw-1; Sun, 05 Apr 2026 10:20:56 -0400 X-MC-Unique: -FTRA5o6OgCyAFH78Otdgw-1 X-Mimecast-MFC-AGG-ID: -FTRA5o6OgCyAFH78Otdgw_1775398855 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 6840D195608F; Sun, 5 Apr 2026 14:20:55 +0000 (UTC) Received: from fedora (unknown [10.44.32.11]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id AA4B51955D84; Sun, 5 Apr 2026 14:20:52 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 5 Apr 2026 16:20:54 +0200 (CEST) Date: Sun, 5 Apr 2026 16:20:51 +0200 From: Oleg Nesterov To: syzbot Cc: io-uring@vger.kernel.org, kees@kernel.org, linux-kernel@vger.kernel.org, luto@amacapital.net, syzkaller-bugs@googlegroups.com, wad@chromium.org Subject: Re: [syzbot] [io-uring?] WARNING in __secure_computing Message-ID: References: <69953966.a70a0220.2c38d7.0111.GAE@google.com> 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 In-Reply-To: <69953966.a70a0220.2c38d7.0111.GAE@google.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 02/17, syzbot wrote: > > WARNING: kernel/seccomp.c:1407 at __secure_computing+0x2ae/0x2e0 kernel/seccomp.c:1407, CPU#1: syz.0.17/6077 #syz test Lets try the approach suggested by Kusaram. I don't see a better fix. Oleg. --- diff --git a/fs/signalfd.c b/fs/signalfd.c index dff53745e352..107a83336657 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -48,17 +48,30 @@ static int signalfd_release(struct inode *inode, struct file *file) return 0; } +static void mk_sigmask(struct signalfd_ctx *ctx, sigset_t *sigmask) +{ + struct k_sigaction *k = current->sighand->action; + int n; + + *sigmask = ctx->sigmask; + for (n = 1; n <= _NSIG; ++n, ++k) { + if (k->sa.sa_flags & SA_IMMUTABLE) + sigaddset(sigmask, n); + } +} + static __poll_t signalfd_poll(struct file *file, poll_table *wait) { struct signalfd_ctx *ctx = file->private_data; __poll_t events = 0; + sigset_t sigmask; poll_wait(file, ¤t->sighand->signalfd_wqh, wait); spin_lock_irq(¤t->sighand->siglock); - if (next_signal(¤t->pending, &ctx->sigmask) || - next_signal(¤t->signal->shared_pending, - &ctx->sigmask)) + mk_sigmask(ctx, &sigmask); + if (next_signal(¤t->pending, &sigmask) || + next_signal(¤t->signal->shared_pending, &sigmask)) events |= EPOLLIN; spin_unlock_irq(¤t->sighand->siglock); @@ -155,11 +168,13 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info int nonblock) { enum pid_type type; - ssize_t ret; DECLARE_WAITQUEUE(wait, current); + sigset_t sigmask; + ssize_t ret; spin_lock_irq(¤t->sighand->siglock); - ret = dequeue_signal(&ctx->sigmask, info, &type); + mk_sigmask(ctx, &sigmask); + ret = dequeue_signal(&sigmask, info, &type); switch (ret) { case 0: if (!nonblock) @@ -174,7 +189,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info add_wait_queue(¤t->sighand->signalfd_wqh, &wait); for (;;) { set_current_state(TASK_INTERRUPTIBLE); - ret = dequeue_signal(&ctx->sigmask, info, &type); + ret = dequeue_signal(&sigmask, info, &type); if (ret != 0) break; if (signal_pending(current)) { @@ -184,6 +199,7 @@ static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, kernel_siginfo_t *info spin_unlock_irq(¤t->sighand->siglock); schedule(); spin_lock_irq(¤t->sighand->siglock); + mk_sigmask(ctx, &sigmask); } spin_unlock_irq(¤t->sighand->siglock);