Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp797892pxb; Thu, 21 Oct 2021 09:39:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbhu80k6+MG0KkQ4SIJ4h9YJWFEFd458bKcBn8pWaMfy1+0Z6PclJ1GpKYTlHtDQpZy4le X-Received: by 2002:a17:906:254b:: with SMTP id j11mr8379458ejb.513.1634834350266; Thu, 21 Oct 2021 09:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634834350; cv=none; d=google.com; s=arc-20160816; b=OZeRikmFL/4rhqT57ftXXHjNQG6qiT8usufOCp9zfNfH+im8+WIZnc47kNocA1r4Ti L4qcEYKhoSJY2Tm9OZk+UtqPnYI4eULha4nLEI3KbXCBDuH0slf3TRZ6ZwjsA7+tQqt4 bmmDvrllMIaQTpWeTd4H9Y7+npE2eQcwRsZjp+18w5EVvF+8SIJyveofkKBwG676wUzN nhSsSDOu3v6cty0/Vw7J2J38qiVOg103iDQXK3aK2JhNBIRoNBvuDv4QaYImX6PMjIDL HCgt8fRHss8Mv20NpZeA+1WRnSYtTjiaVKi0K21nKZJ+/SAd7tDwyQ6gd9p2IHR7IE70 fZGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LwiRYg1y4Y8JWXKUDo5VZzWCK2qWa9LX3G8ahjYL1QI=; b=g5dbo4Dgpyy3FPLIYFk5M5AIyKCOtSLUfWYcm1fByHIj7kPzVg+XltMzTX9TBm6UNF TVmArw/TnfkVVxtYt5GbbJMEhE05vqiFiVkTxZEzDdaiHBUz4sk5y6UrjaFPVuD7H+71 7aLZ8Sa0aQTCquIJfTXkJv+i3DI0+U2j3J3CGR8Lli6nJtjluNn4z9Is04RjeZZHNCFI zwHdb5ZhHMXtqn5r0aw3D850J+gQ1G9tbxP0ocKbVTgCFgpYPup/iXWFW9L5JY6l45J9 hDk8yj/0Y1w2VX8YF8P7Q5GE2SmK3Veae6HG6I8PwM8yuqbmovxosaHBpjNSPYGoeGT2 qJew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NG2DzhWP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si11546564edc.582.2021.10.21.09.38.43; Thu, 21 Oct 2021 09:39:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NG2DzhWP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbhJUQjD (ORCPT + 99 others); Thu, 21 Oct 2021 12:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbhJUQjB (ORCPT ); Thu, 21 Oct 2021 12:39:01 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F92C0613B9 for ; Thu, 21 Oct 2021 09:36:45 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id d9so1135854pfl.6 for ; Thu, 21 Oct 2021 09:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LwiRYg1y4Y8JWXKUDo5VZzWCK2qWa9LX3G8ahjYL1QI=; b=NG2DzhWPPBdyjZ0xmjUFmnFYPeDp25D/LYC4tK7zK2xGNcCduAUfV/B2ozl2wOewxv zXaWilNIbDGOVUS+GUekv/HwNgoUNaoHIDgPpUCtaxtWyqMsso76Sj4y5H+NFbs7fRy9 5wQQ5z10+g+krkDUOT4rQfTjQIJ7dbdeTKUJU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LwiRYg1y4Y8JWXKUDo5VZzWCK2qWa9LX3G8ahjYL1QI=; b=FQKdYY+CxU3OMOpilgt4TbDoZXwlEhIppNpwySfSyE/mHf66qSfqNtT9JveCg4Yiqf PQdg0b14qgANOSrQp3R9mpqWL5r0eGf3mLA4ozAkQdTGHGWDfcQmd0eLDKMdoEo8k0c+ 3rLMPdlle43/+P0rCYGSUqrFKkAfizE00O0G6grNKI9nvu5OPNMCreb0/RrMxb5WqApo Y4Z+KMQIsBxqjFAs+Iow0mmBkdWJtg/OZJfsHzEw8T1+ZvwPfAyq8H03NdvfvSqdfIot aAeIl2PWZSK46hVPG1pyqqrfgVSekXg57+bBgkPBUMO9WnfynG/9DbBqGziHnpbavT+J 95iw== X-Gm-Message-State: AOAM532ZDcq4qwRrtTMwXq47h1Zy6ZOPCZDYWEcrbCZUgP3X1s7Pp4xa hjj9XNOI+Igt6I21qlLpvELMhg== X-Received: by 2002:a05:6a00:1709:b0:44d:faf3:ef2d with SMTP id h9-20020a056a00170900b0044dfaf3ef2dmr6724544pfc.43.1634834205230; Thu, 21 Oct 2021 09:36:45 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s17sm5745776pge.50.2021.10.21.09.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 09:36:44 -0700 (PDT) Date: Thu, 21 Oct 2021 09:36:44 -0700 From: Kees Cook To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Al Viro , Andy Lutomirski Subject: Re: [PATCH 17/20] signal/x86: In emulate_vsyscall force a signal instead of calling do_exit Message-ID: <202110210936.F0EA287E@keescook> References: <87y26nmwkb.fsf@disp2133> <20211020174406.17889-17-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020174406.17889-17-ebiederm@xmission.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 12:44:03PM -0500, Eric W. Biederman wrote: > 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 > Signed-off-by: "Eric W. Biederman" > --- > arch/x86/entry/vsyscall/vsyscall_64.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c > index 1b40b9297083..0b6b277ee050 100644 > --- 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 error_code, > 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) This looks correct to me, but please double-check the x86 selftests if you haven't already. Reviewed-by: Kees Cook -- Kees Cook