Message ID | 20240127044124.57594-1-jinghao7@illinois.edu |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-41075-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2395:b0:106:343:edcb with SMTP id gw21csp331545dyb; Fri, 26 Jan 2024 21:57:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGD0iEbilabL4QTUZJUddfqjJqF8iXfYsNWdcFZgELHB5ioKEYlKOwUZSjfDGBBJCB2Vb68 X-Received: by 2002:adf:ec04:0:b0:337:7d38:4e8b with SMTP id x4-20020adfec04000000b003377d384e8bmr447440wrn.95.1706335019806; Fri, 26 Jan 2024 21:56:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706335019; cv=pass; d=google.com; s=arc-20160816; b=KsbZnKleLsz6PQ0oWeJNuQ4Inb884hZYMNzBzhbvskW9KyzpC0EviQp/ELBh+r3jK/ uFXB9cOKg6j2Hok3JLWDCRTqSr2cne0fHaLLqisgzsxZyZo5Pmo053cmkm7Smp8PKyBt OBkzRLHv62/riP6l327oh5KG4DrkoIsm6a3kONeH/ycyKXRiV40r99reguGwGTQXYRg7 g7E63HALabpf/Lx1inaWtZQd0WFemt9QgJsFNDkfKpaZR2LYr1J5mlER6UJWiC11UTfH d9HwLIBiElIRrhZ7RWDnMWwyaRHVb+KXjjhItyGkW+W7OmBUbnshOSSvT+nLj30BSZX5 m+Wg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Jaf7dwKCpzOam5AxGVkQC1zxu44hKX42z/tivO06WcI=; fh=ihYqxaSOeWkOf/TXzhQINhK9J+TBcUU0y3bPV7PZkzo=; b=ka1WScczOp8Rf7UKhEoxwZNd+x4ha9YAJKKddaR9oAF38MM1jcGoG+gW3AogW+RUFN Xwuj7YhrIQJAxKE2Q1vnI32wr+nMxbomnqHdRkJhdzbF/wN4kFNvMy+SUTp3cj5tMv5A dcfFc54/jdLatYFXGHZujmdvvWb59EWl1CbPEjxFxkqo/XpWw+v9LFHD9icmp9W3zO0/ r/Ng8WXwKgDgHLK3JBQZSOybPM0/nP5xFIaQIIK2NqQKD97hJF1Jj29IUvE/SiNIOHS/ kl/y0J2NYMSEqtk5qGdI4j5YKhf6cSCktUoDAmGmZ5qPfixw+0LNeJzvDl6l+V1e+a3z 1glA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@illinois.edu header.s=campusrelays header.b=bGsxg2TZ; arc=pass (i=1 spf=pass spfdomain=illinois.edu dkim=pass dkdomain=illinois.edu dmarc=pass fromdomain=illinois.edu); spf=pass (google.com: domain of linux-kernel+bounces-41075-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41075-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=illinois.edu Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o5-20020a170906288500b00a318f0a6a33si1293692ejd.372.2024.01.26.21.56.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 21:56:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41075-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@illinois.edu header.s=campusrelays header.b=bGsxg2TZ; arc=pass (i=1 spf=pass spfdomain=illinois.edu dkim=pass dkdomain=illinois.edu dmarc=pass fromdomain=illinois.edu); spf=pass (google.com: domain of linux-kernel+bounces-41075-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41075-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=illinois.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 692E21F2437A for <ouuuleilei@gmail.com>; Sat, 27 Jan 2024 05:56:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BA86154A6; Sat, 27 Jan 2024 05:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=illinois.edu header.i=@illinois.edu header.b="bGsxg2TZ" Received: from mx0b-00007101.pphosted.com (mx0b-00007101.pphosted.com [148.163.139.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E5FD7F; Sat, 27 Jan 2024 05:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.139.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706335002; cv=none; b=D0FGZcUtBEKtQfPdizDcPQXAjdPaQy/O5ic9TvNZrn93TiqDvJmm/66/yGB7iOrvTPQeV61YBBmFWax890QjrF3QcDWJ68AVsThwkHrNQq9gml0uNOcZqaVEwh5Xs9LWhg9VMqUv8j9zY/W95ziTLhX1L2FmF8mk9BfygFwFb7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706335002; c=relaxed/simple; bh=QmTDRUbNHgrq5t9JI5UYewOWGURNdPHH08srd4UcjQA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=I4b9SBFTmLliRO3P7DggrM/u0zMjrZOvURkfiM6xYnqHSYHHX/cFaAGiUV9lwQCFIdDD7RfNI8TYVs/OXPSEXxw0NGW4y1RBQDu8nGnntIUaO6fiZ7wqq/AU6IZ39c1rAuN+lI6gTAv/y7lNeNJ6N4dckCUXfPjK8/jRMXgOA4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=illinois.edu; spf=pass smtp.mailfrom=illinois.edu; dkim=pass (2048-bit key) header.d=illinois.edu header.i=@illinois.edu header.b=bGsxg2TZ; arc=none smtp.client-ip=148.163.139.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=illinois.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=illinois.edu Received: from pps.filterd (m0166258.ppops.net [127.0.0.1]) by mx0b-00007101.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40R48jDX026485; Sat, 27 Jan 2024 04:41:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illinois.edu; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=campusrelays; bh=Jaf7dwKCpzOam5AxGVkQC1zxu44hKX42z/tivO06WcI=; b=bGsxg2TZ2xE8ej0BpJ/gSoVrfxGnS5ugqZwGMh93/llF/eNRRRea/irYHs3FfIDUZlJX ibkixVycodjAcYTV5aGXRD7jEsi7VlED3Z92hVyjV9noUAZUxj3AxO02rPqBAUIae1ni cvCDspJe/mXcTJzbaCco3J3bOjCb0IuCuc/ew+DBeN7lA2eGRPDmkwBL6x6EX7llFVt4 EmpmsoM6ZCgqRjS8ABGsiPVcl7cuW3JWV2AliiU6Qbc6a6zgApV1fXJHLdVZ7OI+ObqQ J73LBn9KHqpF/JLBuC6MFL9eh8wnCKEsASBzHFdgxhSkCJtHGjXK7l1NBeeJuOu8GSiJ sQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-00007101.pphosted.com (PPS) with ESMTPS id 3vvr6sgk29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 27 Jan 2024 04:41:36 +0000 Received: from m0166258.ppops.net (m0166258.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40R4fZW7019561; Sat, 27 Jan 2024 04:41:36 GMT Received: from localhost.localdomain (oasis.cs.illinois.edu [130.126.137.13]) by mx0b-00007101.pphosted.com (PPS) with ESMTP id 3vvr6sgk26-1; Sat, 27 Jan 2024 04:41:35 +0000 From: Jinghao Jia <jinghao7@illinois.edu> To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Peter Zijlstra <peterz@infradead.org> Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, Jinghao Jia <jinghao7@illinois.edu> Subject: [RFC PATCH 0/2] x86/kprobes: add exception opcode detector and boost more opcodes Date: Fri, 26 Jan 2024 22:41:22 -0600 Message-ID: <20240127044124.57594-1-jinghao7@illinois.edu> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: kVJuc-U0v0AAMI2LBDzzUlJWS0ZpTZDO X-Proofpoint-ORIG-GUID: 6YLeFrF7svbWsgXIk0n3OeKrq3OypKIi X-Spam-Details: rule=cautious_plus_nq_notspam policy=cautious_plus_nq score=0 impostorscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1011 mlxlogscore=899 phishscore=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401270033 X-Spam-Score: 0 X-Spam-OrigSender: jinghao7@illinois.edu X-Spam-Bar: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789221949520579145 X-GMAIL-MSGID: 1789221949520579145 |
Series |
x86/kprobes: add exception opcode detector and boost more opcodes
|
|
Message
Jinghao Jia
Jan. 27, 2024, 4:41 a.m. UTC
Hi everyone, This patch set makes the following 2 changes: - It adds an exception opcode detector to prevent kprobing on INTs and UDs. These opcodes serves special purposes in the kernel and kprobing them will also cause the stack trace to be polluted by the copy buffer address. This is suggested by Masami. - At the same time, this patch set also boosts more opcodes from the group 2/3/4/5. The newly boosted opcodes are all arithmetic instructions with semantics that are easy to reason about, and therefore, they are able to be boosted and executed out-of-line. These instructions were not boosted previously because they use opcode extensions that are not handled by the kernel. But now with the instruction decoder they can be easily handled. Boosting (and further jump optimizing) these instructions leads to a 10x performance gain for a single probe on QEMU. Jinghao Jia (2): x86/kprobes: Prohibit kprobing on INT and UD x86/kprobes: boost more instructions from grp2/3/4/5 arch/x86/kernel/kprobes/core.c | 54 ++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 13 deletions(-) -- 2.43.0