Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp469145pxv; Thu, 24 Jun 2021 12:00:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGmF86ei7YN5AQYuDqrONLSvm5+Ry38JEy9phU7LIsbFioyw3vlYd8UUY/ki2BeKXfWXk5 X-Received: by 2002:a02:77d1:: with SMTP id g200mr5993981jac.132.1624561206511; Thu, 24 Jun 2021 12:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624561206; cv=none; d=google.com; s=arc-20160816; b=OzqH+X4MJOgXHx0I8PjJuZQrlga0FnAzB6IpsXksymU+JzJtUBlzxFAInokGfnuH7F GOf7mz9QeR7xICjg5kwkynEzpL5dCGi7SnedVVa1mxsu/G6hHajYqVWvnFgPKeISPetJ LGn9F8hRGMNe4sIfR1G2f5H5Ev4TheGbqwdZcCVFJgncVZi7hgI9q38HsVC5D+tW0b+J /3CFa2I+CruCwSG+N7v2XT5fyMlRK01BDV8H1uwqwjXEGGkIXea/excgWQZEdOgn2F3P NJlO4JKEQxvVOKAGK1GI8BsNofE1pUIPKDCVH5ytDAjcO7hEr+/jwUoikqTAvHuNH6ah Dbsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=nctOTR1pxRSO+sammqKXJ+t4R0o7VNTJSNiJAegFbLQ=; b=N5wY8Hlt5cLjdvykZUJdx04QhBDeGTp2VGkZYoSyVzzixp3FkPBxE9nx/enQd+hJOx 0GG1yCCNpZSypYGMU/urM0WUZDBPhYqwb443czcLroDsKWENR/Wj5NyDeqq9bxIIBuuN mMavo1QWpprSAUlLVQEk1qV6iwTk9WgWClqxiOC8hh0Fk2kbkvwAdPOOLoX25tuFlV+D aOSCtFDYeNPCcE+jI89XYBXoK6Nza34lR1hY37hpE9yo43piS+txf3Er6yBEGk+B1nmj 5uff1zy22t5ltJhnnUoYCL/QuRn8f3uSS+I02+J6SEBBZnMJmpnwF4Yi/+UyhRnraeb0 IUBQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 16si4578926ilt.38.2021.06.24.11.59.53; Thu, 24 Jun 2021 12:00:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbhFXTBh (ORCPT + 99 others); Thu, 24 Jun 2021 15:01:37 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:35718 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhFXTBh (ORCPT ); Thu, 24 Jun 2021 15:01:37 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lwUZI-00096b-Ou; Thu, 24 Jun 2021 12:59:16 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:46990 helo=email.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lwUZE-003RF0-8B; Thu, 24 Jun 2021 12:59:16 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Al Viro , Michael Schmitz , linux-arch , Jens Axboe , Oleg Nesterov , Linux Kernel Mailing List , Richard Henderson , Ivan Kokshaysky , Matt Turner , alpha , Geert Uytterhoeven , linux-m68k , Arnd Bergmann , Ley Foon Tan , Tejun Heo , Kees Cook References: <87sg1lwhvm.fsf@disp2133> <6e47eff8-d0a4-8390-1222-e975bfbf3a65@gmail.com> <924ec53c-2fd9-2e1c-bbb1-3fda49809be4@gmail.com> <87eed4v2dc.fsf@disp2133> <5929e116-fa61-b211-342a-c706dcb834ca@gmail.com> <87fsxjorgs.fsf@disp2133> <87a6njf0ia.fsf@disp2133> <87tulpbp19.fsf@disp2133> <87zgvgabw1.fsf@disp2133> <875yy3850g.fsf_-_@disp2133> Date: Thu, 24 Jun 2021 13:59:04 -0500 In-Reply-To: <875yy3850g.fsf_-_@disp2133> (Eric W. Biederman's message of "Thu, 24 Jun 2021 13:57:35 -0500") Message-ID: <87zgvf6qdj.fsf_-_@disp2133> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1lwUZE-003RF0-8B;;;mid=<87zgvf6qdj.fsf_-_@disp2133>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+5j7k08D5eTmmAZgbcD6377xu6DvCzgsU= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa04.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TooManySym_01,T_TooManySym_02, T_TooManySym_03,XMNoVowels,XMSubLong autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 1.5 TR_Symld_Words too many words that have symbols inside * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.7 XMSubLong Long Subject * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_03 6+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 3754 ms - load_scoreonly_sql: 0.12 (0.0%), signal_user_changed: 13 (0.3%), b_tie_ro: 11 (0.3%), parse: 1.53 (0.0%), extract_message_metadata: 16 (0.4%), get_uri_detail_list: 1.57 (0.0%), tests_pri_-1000: 20 (0.5%), tests_pri_-950: 1.59 (0.0%), tests_pri_-900: 1.36 (0.0%), tests_pri_-90: 2414 (64.3%), check_bayes: 2412 (64.2%), b_tokenize: 9 (0.2%), b_tok_get_all: 7 (0.2%), b_comp_prob: 2.6 (0.1%), b_tok_touch_all: 2389 (63.6%), b_finish: 1.27 (0.0%), tests_pri_0: 1254 (33.4%), check_dkim_signature: 0.84 (0.0%), check_dkim_adsp: 3.6 (0.1%), poll_dns_idle: 1.14 (0.0%), tests_pri_10: 4.8 (0.1%), tests_pri_500: 24 (0.6%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 1/9] signal/sh: Use force_sig(SIGKILL) instead of do_group_exit(SIGKILL) X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Today the sh code allocates memory the first time a process uses the fpu. If that memory allocation fails kill the affected task with force_sig(SIGKILL) rather than do_group_exit(SIGKILL). Calling do_group_exit from an exception handler can potentially lead to locking dead locks as do_group_exit is not designed to be called from interrupt context. Instead use force_sig(SIGKILL) to kill the userspace process. Sending signals in general and force_sig in particular has been tested from interrupt context so there should be no problems. Signed-off-by: "Eric W. Biederman" --- arch/sh/kernel/cpu/fpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c index ae354a2931e7..fd6db0ab1928 100644 --- a/arch/sh/kernel/cpu/fpu.c +++ b/arch/sh/kernel/cpu/fpu.c @@ -62,18 +62,20 @@ void fpu_state_restore(struct pt_regs *regs) } if (!tsk_used_math(tsk)) { - local_irq_enable(); + int ret; /* * does a slab alloc which can sleep */ - if (init_fpu(tsk)) { + local_irq_enable(); + ret = init_fpu(tsk); + local_irq_disable(); + if (ret) { /* * ran out of memory! */ - do_group_exit(SIGKILL); + force_sig(SIGKILL); return; } - local_irq_disable(); } grab_fpu(regs); -- 2.20.1