Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp770436pxb; Thu, 21 Oct 2021 09:09:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC2DWjJHBCn2UGwtmdNdoI/z5LMDC3gBGtpFVtsUxBMA9fgGam+5NkVmbfxMgOYQFAMtJ9 X-Received: by 2002:a63:6c41:: with SMTP id h62mr4783370pgc.206.1634832568068; Thu, 21 Oct 2021 09:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634832568; cv=none; d=google.com; s=arc-20160816; b=Jentbj6Vq59NtUUSQsM3e3MJ4HKF2/z+2DodMmWbA189xnUb2GInP1dGxZbSMOGvia R/9uk5XGMOfYFhzFLSyK/+kCJ4z//HIHILTWLU4nw8r62yyxZ/2EF1xvp/4/QHPJtNvH kuLOEBRWzX9ST1gQsq4JaCuB0odggP93mGlGaRR1e105GUwu+CL7Ho+PRqgVbqez7oS/ pS/SKCIVcYnWjwnpwqInA1sKBVc9mP4397GLzAmMCa3upgcPO9THLkKNO6i5bgKtadzw +ApGNbKsi3Sevu0yjNhwIdCeVAbSuuGe40HV1gNHOsZ/HfkqLypuDX3s+3RO/UKiH75S khvA== 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=m3LNgj0O/EXMuPerErFfv8v3ZBKINoSF6egU7Q9+w6o=; b=EzPBEZM9ID7a/n5DkDiEbhHC853PM4ICoDBeRM1sX7JvXwZSB6/rGV8hBaBbeCOk59 MdpIIb4aUQjIJbiM8cX1Ps9DBSZ4MxlKlRJ7cbfPxY1DcrUY5b7QuexIC/tkuWtFjuGe w4kHX4zTIXG+RS5kkdJgUzhnyA5oU9en/7OlXmhDgwMYvbkxK91fcMFCJl8aRxTuvDyR FGOPT2pHwEFiyIcEC63k9Grvp0SkqvGkGBX5O2/5s2O+KUSzgTY6Vqys3lbA3MC3/cro m1I2csiK7Ph2lNsog78bXTPJ/GDQ/UJjokErQTpNhsO/JOnlI+ZbTZDhtaawQZS5CIMO 6yag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VluUCZI5; 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 o8si6818132plk.384.2021.10.21.09.09.15; Thu, 21 Oct 2021 09:09:28 -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=VluUCZI5; 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 S231644AbhJUQJJ (ORCPT + 99 others); Thu, 21 Oct 2021 12:09:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbhJUQJI (ORCPT ); Thu, 21 Oct 2021 12:09:08 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C47C0613B9 for ; Thu, 21 Oct 2021 09:06:52 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id y4so785229plb.0 for ; Thu, 21 Oct 2021 09:06:52 -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=m3LNgj0O/EXMuPerErFfv8v3ZBKINoSF6egU7Q9+w6o=; b=VluUCZI5Zb5BTknGwQTyQF+4e1x/d0hzfTejBQzID7EOo2c7LL2H55BJCJyzDqz+TY eopKS0vvjh1ta40dEl/PecFKas4qyf0oFKD9A4UW7/OqH1mtSPUfkEMqv2oYbNmDH5et RgtwwZtcSQXUO/559PvY3hzysWPdXVTGUMTfk= 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=m3LNgj0O/EXMuPerErFfv8v3ZBKINoSF6egU7Q9+w6o=; b=dkv4x5KLVLhMZ8EWWh1+4wW+Wn1uoPzLzZaq1dk/I9SoGxg1LTA4xcffHbCEpLUZW3 fS+TyT5ork7fpfwXG3G/5S/IVWO5Vik/eWgm3g8eJZD8gobRVAbDKFJrxfS+6OSeH4+v Qks/8tfMqQ3tVScPu7QesH1yPGz+74WtDjuQa4V9z800MxL4QccVon2oloy0h3biC5PX Czmk4eai8ymIh6toK80hEsdBgSxlRwflCg3AmHRK7EC2WfGxhHvmOQyyvj7xN4c4G5ow ZTHljxuNEXAoJmLcz3LWYyImB/P1fzRDmsF4E1sBttNLYflgeGqeJi/AaLb1eDDIoTv4 yoDA== X-Gm-Message-State: AOAM531A0038pJABGQTTnjaCPhFJrl58L3/80x+NL6LkH0nocdJR1opG bgDXrlq+OWO1OA1oY8lO08GcZA== X-Received: by 2002:a17:902:c94e:b0:13f:1b02:e539 with SMTP id i14-20020a170902c94e00b0013f1b02e539mr5894109pla.72.1634832411588; Thu, 21 Oct 2021 09:06:51 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s2sm5721985pgd.13.2021.10.21.09.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 09:06:51 -0700 (PDT) Date: Thu, 21 Oct 2021 09:06:50 -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 , Thomas Bogendoerfer , Maciej Rozycki , linux-mips@vger.kernel.org Subject: Re: [PATCH 05/20] signal/mips: Update (_save|_restore)_fp_context to fail with -EFAULT Message-ID: <202110210906.AA70D50BA@keescook> References: <87y26nmwkb.fsf@disp2133> <20211020174406.17889-5-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211020174406.17889-5-ebiederm@xmission.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 12:43:51PM -0500, Eric W. Biederman wrote: > When an instruction to save or restore a register from the stack fails > in _save_fp_context or _restore_fp_context return with -EFAULT. This > change was made to r2300_fpu.S[1] but it looks like it got lost with > the introduction of EX2[2]. This is also what the other implementation > of _save_fp_context and _restore_fp_context in r4k_fpu.S does, and > what is needed for the callers to be able to handle the error. > > Furthermore calling do_exit(SIGSEGV) from bad_stack is wrong because > it does not terminate the entire process it just terminates a single > thread. > > As the changed code was the only caller of arch/mips/kernel/syscall.c:bad_stack > remove the problematic and now unused helper function. > > Cc: Thomas Bogendoerfer > Cc: Maciej Rozycki > Cc: linux-mips@vger.kernel.org > [1] 35938a00ba86 ("MIPS: Fix ISA I FP sigcontext access violation handling") > [2] f92722dc4545 ("MIPS: Correct MIPS I FP sigcontext layout") > Fixes: f92722dc4545 ("MIPS: Correct MIPS I FP sigcontext layout") > Signed-off-by: "Eric W. Biederman" Reviewed-by: Kees Cook -- Kees Cook