Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3406792pxy; Mon, 26 Apr 2021 00:36:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoxcMfZ+8O8zGjjYcGO3OaQbU2wzIVdIBTYQBBr7Wz+tKrDIUKLGhZIUV8r0jrd48Bc8Ja X-Received: by 2002:a50:eb45:: with SMTP id z5mr19668881edp.243.1619422582807; Mon, 26 Apr 2021 00:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619422582; cv=none; d=google.com; s=arc-20160816; b=iU2IC6a+uwgdXYoPiR1a43x3blaFH4NMNrN2Xf9vqH0MeLhMOHxwzuT6YzuzXwV0Mq clgs/cXUQho3P6KEiXG9SBrN2n93VXj+T6oxw33zJ3o2Kv5/OpK7PriURlVfh5RttVnM ljrg/0zsAB1G/TzyboIOr3Vy6rVwGCknB5QLoFeHx4cGHGHbsOocx3S5o8hLKDF+gMoo wwZN8hL4/EtLY9zys0UbU9ziVOB7FwrMV05ipZj2jhigF1V+QfQenmCPTrQQzqY/3/xz WowYuqMqn3TVJDsK2CMxoaqP2XIR8Xy3XABFi19o81BrxEM+FIoimbSXuTSNxjlitgcD 6QvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2+EHK+S4gJ6M7Ek0Mmhhf4YwITf+CVObWGebxJ+oCRs=; b=RSsf9ZluCyPokSXn2N8jBVFFksIb3TRVXQqOg2lGTLSbMzgRRnmS4SuVQiqxlf56NL kugfer6Rp3omeaV8F9Xz9W+jOlO2WckjHABtOXGTJgjYg8WuXEQV+bKMM5eYRhtzZV64 luiV5egl39WJZdfviRwfD8fnHRh2x93OJ6MzY5Md4zo50M+6vKaVjAsRMg9vAnGOFXsa JgNBFVdDiIPB4JxrlxoVPX7RECZ3LDce1EtcrdNHnNh4JKsHAzI1t4Wtuul9SkMVSvtJ zaCHNmTyUOhXR3jsLGX5Lb/fIFCL7aLketxtqevhyr2WNcY8NdWskVT7FerRGkKKuvDU g4hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nmd3zUYg; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c19si13966884ejj.494.2021.04.26.00.35.58; Mon, 26 Apr 2021 00:36:22 -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=@linuxfoundation.org header.s=korg header.b=Nmd3zUYg; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbhDZHcZ (ORCPT + 99 others); Mon, 26 Apr 2021 03:32:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:43220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbhDZHcW (ORCPT ); Mon, 26 Apr 2021 03:32:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6672061006; Mon, 26 Apr 2021 07:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619422299; bh=mVyWi9XG90EchzaJQHS0kyf10Ks7lxWF4bcLEboImsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nmd3zUYg7xhGfT/2CuLlhq+tAuEHJahEd8x8QKONrhD5OvVjE1TyNLQqX/K+27Iwe i6gNGtlIs6MYyz0P4J50H/FWwlfULqDGV4sHkoMc0umuz84iANaG//HAB6HSgWsV3B 39WsoIrxoYSObqGDgtG7Ep0vbKH6Ht02sL39LfM8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fredrik Strupe , Russell King Subject: [PATCH 4.4 21/32] ARM: 9071/1: uprobes: Dont hook on thumb instructions Date: Mon, 26 Apr 2021 09:29:19 +0200 Message-Id: <20210426072817.296558540@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210426072816.574319312@linuxfoundation.org> References: <20210426072816.574319312@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: Fredrik Strupe commit d2f7eca60b29006285d57c7035539e33300e89e5 upstream. Since uprobes is not supported for thumb, check that the thumb bit is not set when matching the uprobes instruction hooks. The Arm UDF instructions used for uprobes triggering (UPROBE_SWBP_ARM_INSN and UPROBE_SS_ARM_INSN) coincidentally share the same encoding as a pair of unallocated 32-bit thumb instructions (not UDF) when the condition code is 0b1111 (0xf). This in effect makes it possible to trigger the uprobes functionality from thumb, and at that using two unallocated instructions which are not permanently undefined. Signed-off-by: Fredrik Strupe Cc: stable@vger.kernel.org Fixes: c7edc9e326d5 ("ARM: add uprobes support") Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/probes/uprobes/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm/probes/uprobes/core.c +++ b/arch/arm/probes/uprobes/core.c @@ -207,7 +207,7 @@ unsigned long uprobe_get_swbp_addr(struc static struct undef_hook uprobes_arm_break_hook = { .instr_mask = 0x0fffffff, .instr_val = (UPROBE_SWBP_ARM_INSN & 0x0fffffff), - .cpsr_mask = MODE_MASK, + .cpsr_mask = (PSR_T_BIT | MODE_MASK), .cpsr_val = USR_MODE, .fn = uprobe_trap_handler, }; @@ -215,7 +215,7 @@ static struct undef_hook uprobes_arm_bre static struct undef_hook uprobes_arm_ss_hook = { .instr_mask = 0x0fffffff, .instr_val = (UPROBE_SS_ARM_INSN & 0x0fffffff), - .cpsr_mask = MODE_MASK, + .cpsr_mask = (PSR_T_BIT | MODE_MASK), .cpsr_val = USR_MODE, .fn = uprobe_trap_handler, };