Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2578021pxb; Mon, 19 Apr 2021 08:49:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSX+VSz6YYzC6ERt6DfSbsvUzoVY6/ms8tNA1xwWLfEWmvMddtlLGvw/b2omXkvIUw65rf X-Received: by 2002:a65:5888:: with SMTP id d8mr2509760pgu.23.1618847362469; Mon, 19 Apr 2021 08:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618847362; cv=none; d=google.com; s=arc-20160816; b=dCAdGmDNPDKY/GA/vPsCNvOPSrJkbox1MxhvN8NiB249WZBhLqeE9tL7oz6iTZP4ng aCKZF7x6bC4skxQ8xyDyZRH5YxvUTlFcMWRHCplsI0ZHqhHIYnngL6e4Nba1qNwjcEDo rxkzNekpXbatajXt35YDnC9hBTpRUJm5IlAdMze5w2nsCUn6ECPmn7jWIrCTKd+Mx+wJ czsnR8A93JwhtyED1QLTjt7GLu592yrpWPkSE8sAHMC0Rh3PxtOy8zKa+ctWYYO3GfvU pT1HBXW6tYMpbBMDVrrhJgzp8ykN+qMBw18DJbV3BDDMnXYTS2duPCWxWaEOnKEr5mUO fQ8Q== 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=GRwtluSuLv4un9sUSuPK/Nxuf7cxh+36vKVaz1PRW5k=; b=N+Pc3zJgfyOfVmbIo2aILvlp5WXinKG4+aOEqKuGX0JbPvrx03nAoo9hb7pIrOIPgq rsG40wgKB4n/TIChcNXd+4yBRgMaU5B1fs14U4VRA/UuYHHOiyPMkdCd1kTIwW2tnPyF 4nHtSUU9n9lsIhwWhmG+/HLiPP60eolZ6I9d6hk/g9Y3Y8ySdXN5aXh7Q8KmPEEI0m2j jgkC+ck25Hc5CfROjwXGtEJZqt46CHu/3umbI7reKmfqT7o3DMREE3nhZyqAKTy4mX+X RFRYLScpA/ijybhLV5Ja37mYMDeZSSf7kGZS4Cs+OEjOThxTDjDb8a4xWwBqQG8PbyQg kfBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IlQfXqCQ; 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 ha13si17373285pjb.92.2021.04.19.08.49.07; Mon, 19 Apr 2021 08:49: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=IlQfXqCQ; 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 S242912AbhDSNaS (ORCPT + 99 others); Mon, 19 Apr 2021 09:30:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:57240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238936AbhDSNVF (ORCPT ); Mon, 19 Apr 2021 09:21:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D00AF613FD; Mon, 19 Apr 2021 13:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838258; bh=Byr+fhg5Lf5vgurkOuCBRAGK4/82Kv6/CDnJUn53+ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IlQfXqCQoBmo5SZcb8ZN8jxChVB8UsxGVuNCtXumS52gYItgJrDl5lXEYZEvzmAkI FF6iUDlEoAhYkMU12hmmYJvqFsATi4kV64wTjprTy834U0cVkkfnFEIcvWWJ6f4aRU cot7TAq3PS33jH3iOu1hfdGlhOHAivn4+8wpuz5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fredrik Strupe , Russell King Subject: [PATCH 5.10 099/103] ARM: 9071/1: uprobes: Dont hook on thumb instructions Date: Mon, 19 Apr 2021 15:06:50 +0200 Message-Id: <20210419130531.183656528@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@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 @@ -204,7 +204,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, }; @@ -212,7 +212,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, };