Received: by 10.223.176.46 with SMTP id f43csp4700313wra; Tue, 23 Jan 2018 13:12:46 -0800 (PST) X-Google-Smtp-Source: AH8x2265VXDZ3QQYeqkA0fDyW37YLwvwAiNXhCAcSCRojY38vB0CfNfRVxZwo+SU9VpfUfgfL/8b X-Received: by 10.36.116.20 with SMTP id o20mr5862399itc.135.1516741966165; Tue, 23 Jan 2018 13:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516741966; cv=none; d=google.com; s=arc-20160816; b=uaQxo0IBn5PrZzeriCPPoApW8gU6Y/9CuZ6cuQzVWW36ozwK7HazjFBlYayPuYcXsO MtT1xXpbF6uPJTnumai5inUH9FZL7cK+QllSHynriQVwBPjz4eKu0+h9GgMPYL01fszm 54F/r1+E7+GpZvTWYq14oBDmXtffGuFB5NOxYIJX+k93unTRfllBSVc48fLZksSgFfng EqzHK3TdKopgDtLaLHN9Q9Iil1dtbvaBulb8JseUgkap+HRaxBmrub4tuYBoyHPgIKig rdvam9khUA0yWFTcR+x/bYUcaTW5r12TvWhp823E3McFq46GPHeI3aC4z011lTRIB79R /xMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=g3ncbbMme1Gdc+7+1ri0mM7OPCyaK0H7733N6wsZ84g=; b=Ti4feIpOjD10KpZmhd/pLAzR9zj/eiwLTdmNYeTbFk+uXOevw39r2dY2OndQeRwTib UqYdyVH1bE4hSWAMHlqQfoPhdpHPisI4fuWG2K2hbsmoLob+6CXU3e5wP4XHMIsbAobZ d0K8s1Rztof2+f20PaOyEJpzj5f9QyZU2yYArYK9C4WL5nZz5jH1otE3aiZz7dmX6ghS 6p5C3W5kHP22A3Vyc7xFJQQ4N6n4Ob0kgH6QY+za8AY1qhwm4tygccWi7NEflvm0ZqeC HT06wQivbPNEzaK43NxhHYoAvwxj6rVpiXFnzX6FjRKvkcBLVYXvBLjsFQORr0H/NS3N UlaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r77si15186642ioe.254.2018.01.23.13.12.32; Tue, 23 Jan 2018 13:12:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932236AbeAWVLC (ORCPT + 99 others); Tue, 23 Jan 2018 16:11:02 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:51877 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932213AbeAWVI5 (ORCPT ); Tue, 23 Jan 2018 16:08:57 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ee5oP-0001OM-Ap; Tue, 23 Jan 2018 14:08:57 -0700 Received: from 97-121-88-104.omah.qwest.net ([97.121.88.104] helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ee5oN-0003u7-Q1; Tue, 23 Jan 2018 14:08:57 -0700 From: "Eric W. Biederman" To: linux-kernel@vger.kernel.org Cc: Al Viro , Oleg Nesterov , linux-arch@vger.kernel.org, Ram Pai , "Eric W. Biederman" Date: Tue, 23 Jan 2018 15:07:11 -0600 Message-Id: <20180123210719.10456-2-ebiederm@xmission.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <87607s5lra.fsf_-_@xmission.com> References: <87607s5lra.fsf_-_@xmission.com> X-XM-SPF: eid=1ee5oN-0003u7-Q1;;;mid=<20180123210719.10456-2-ebiederm@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.121.88.104;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18FcMG5bOm1639krt7h9RS2891BLLa3fUk= X-SA-Exim-Connect-IP: 97.121.88.104 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa06.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TooManySym_01,XMNoVowels,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;linux-kernel@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 1189 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 3.2 (0.3%), b_tie_ro: 2.2 (0.2%), parse: 1.06 (0.1%), extract_message_metadata: 12 (1.0%), get_uri_detail_list: 1.65 (0.1%), tests_pri_-1000: 6 (0.5%), tests_pri_-950: 1.19 (0.1%), tests_pri_-900: 1.04 (0.1%), tests_pri_-400: 18 (1.5%), check_bayes: 17 (1.4%), b_tokenize: 5 (0.4%), b_tok_get_all: 5 (0.4%), b_comp_prob: 1.87 (0.2%), b_tok_touch_all: 2.7 (0.2%), b_finish: 0.66 (0.1%), tests_pri_0: 1138 (95.7%), check_dkim_signature: 0.53 (0.0%), check_dkim_adsp: 2.7 (0.2%), tests_pri_500: 6 (0.5%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 02/10] signal/arm64: Better isolate the COMPAT_TASK portion of ptrace_hbptriggered X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of jumpping while !is_compat_task placee all of the code inside of an if (is_compat_task) block. This allows the int i variable to be properly limited to the compat block no matter how the rest of ptrace_hbptriggered changes. In a following change a non-variable declaration will preceed was made independent to ensure the code is easy to review. Signed-off-by: "Eric W. Biederman" --- arch/arm64/kernel/ptrace.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 7c44658b316d..0a1cf830e4b3 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -188,26 +188,23 @@ static void ptrace_hbptriggered(struct perf_event *bp, }; #ifdef CONFIG_COMPAT - int i; - - if (!is_compat_task()) - goto send_sig; + if (is_compat_task()) { + int i; - for (i = 0; i < ARM_MAX_BRP; ++i) { - if (current->thread.debug.hbp_break[i] == bp) { - info.si_errno = (i << 1) + 1; - break; + for (i = 0; i < ARM_MAX_BRP; ++i) { + if (current->thread.debug.hbp_break[i] == bp) { + info.si_errno = (i << 1) + 1; + break; + } } - } - for (i = 0; i < ARM_MAX_WRP; ++i) { - if (current->thread.debug.hbp_watch[i] == bp) { - info.si_errno = -((i << 1) + 1); - break; + for (i = 0; i < ARM_MAX_WRP; ++i) { + if (current->thread.debug.hbp_watch[i] == bp) { + info.si_errno = -((i << 1) + 1); + break; + } } } - -send_sig: #endif force_sig_info(SIGTRAP, &info, current); } -- 2.14.1