Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 017EEC4332F for ; Wed, 24 Nov 2021 14:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349923AbhKXOKh (ORCPT ); Wed, 24 Nov 2021 09:10:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:53632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346674AbhKXOGc (ORCPT ); Wed, 24 Nov 2021 09:06:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B2986125F; Wed, 24 Nov 2021 13:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637759560; bh=aS74qLvOSDeCEN3oKU+EhEsJtlz4Of8y6BZtILjRghs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDnRqGL8vo5aw+OpW7ie3kiHMaddLFMHGqHBxEAB8R9NtXl0MMc1SZO03QCiIwg33 dnAz8vaAMnTFdmU+8J3hKwZY3Y8GgEQwomF078nwHE+6XG6QRybExgHY83vj6EWzop btXbr+xGGjMkQswoXYAczvFwhmWKJPkn/jGjBk0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , "Eric W. Biederman" , Thomas Backlund Subject: [PATCH 5.15 263/279] signal/x86: In emulate_vsyscall force a signal instead of calling do_exit Date: Wed, 24 Nov 2021 12:59:10 +0100 Message-Id: <20211124115727.794406414@linuxfoundation.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211124115718.776172708@linuxfoundation.org> References: <20211124115718.776172708@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric W. Biederman commit 695dd0d634df8903e5ead8aa08d326f63b23368a upstream. Directly calling do_exit with a signal number has the problem that all of the side effects of the signal don't happen, such as killing all of the threads of a process instead of just the calling thread. So replace do_exit(SIGSYS) with force_fatal_sig(SIGSYS) which causes the signal handling to take it's normal path and work as expected. Cc: Andy Lutomirski Link: https://lkml.kernel.org/r/20211020174406.17889-17-ebiederm@xmission.com Signed-off-by: Eric W. Biederman Cc: Thomas Backlund Signed-off-by: Greg Kroah-Hartman --- arch/x86/entry/vsyscall/vsyscall_64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/entry/vsyscall/vsyscall_64.c +++ b/arch/x86/entry/vsyscall/vsyscall_64.c @@ -226,7 +226,8 @@ bool emulate_vsyscall(unsigned long erro if ((!tmp && regs->orig_ax != syscall_nr) || regs->ip != address) { warn_bad_vsyscall(KERN_DEBUG, regs, "seccomp tried to change syscall nr or ip"); - do_exit(SIGSYS); + force_fatal_sig(SIGSYS); + return true; } regs->orig_ax = -1; if (tmp)