Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5968574pxu; Wed, 23 Dec 2020 09:46:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdNgO6x3erbmH5TK4wDDjOxk63LWSD7EE5DNgTVf/YyaKjU9G2dsVgK7sAIcH6jUBMGyWp X-Received: by 2002:a50:d553:: with SMTP id f19mr25293141edj.323.1608745610681; Wed, 23 Dec 2020 09:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608745610; cv=none; d=google.com; s=arc-20160816; b=LgFqktIK64w0rl26z8kHV1Kolg0lZEQ75GbH/tGZUxq1DjGsarNiLqPTRGEhhl1arY 8eh52pKOqdX1KxewbHGDemXi+owSudJw8RBDatxtt82r0a+ErGuhhfhjWAdI2NP1Dguf rKdn2jvxq+sfkcQcGfJ4WtAJhb6rY6Pr/j4V2jme6FdbkzeXmcAFzP0ZGvL3cphuVscr C03FN+cE6ARbI0Fml84PFXf5gOvYBmtRgbZLxkYk/Pd/dSbO15ipAQ2ySikFJaW2+KBk 5COddAVVFajS6OGNSVEZKZBTiGvF/pYzJlwtqj64SA5w7TDoZv3jbzb7DrkiwYDubHOd oegA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fms/cSkyvq6e7l0EUpGKreWH3nSqsG+/t272Cvtx7BI=; b=hIGnCqYS8sUXDseIILtLcZ85+shtGD/ysA4ET6OQxh5xeh3AHP/mcQVIVPCnlD9J2R NDvYO/hyDgbBl3UOtYuD9eKzD1/YbaZNBHssowhA4PHNTWpcAl3aquVKzbUvBn5f3djW 0G2mXTRHzuEJwpWqjaHDrGre7IdYiIxpWM2S9hIf5mIWm4IbrcDmGcN56fW2DFry2KRf qMzY+uy9OdKfxxnCl/fWka8x0WA2XVsyxKLZMSsyDo0Abg2vFMln78OEl3zJyB8ztsLh F2Xb43bJB96utBHw5FpO9M4A7GaKy2RYytdBtpICNyKUAJhPBK0CyG6yGcwj6qTFw9nb rx0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZZk88Gag; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si14494349edy.595.2020.12.23.09.46.28; Wed, 23 Dec 2020 09:46:50 -0800 (PST) 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=@alien8.de header.s=dkim header.b=ZZk88Gag; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728697AbgLWRoF (ORCPT + 99 others); Wed, 23 Dec 2020 12:44:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbgLWRoE (ORCPT ); Wed, 23 Dec 2020 12:44:04 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96AA3C061248 for ; Wed, 23 Dec 2020 09:42:51 -0800 (PST) Received: from zn.tnic (p200300ec2f0de600b74d534b1676c98b.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:e600:b74d:534b:1676:c98b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 365BC1EC04B9; Wed, 23 Dec 2020 18:42:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1608745370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fms/cSkyvq6e7l0EUpGKreWH3nSqsG+/t272Cvtx7BI=; b=ZZk88GagquEoIHETFI5cWxDeY/lar/MY2qIo2WwB0SE7fa5r/lrahbgOJzipOT9Q8I5mcf l/6mVTepSRWXsrJ4ete1ZXVAYSZ99VacdDLT16AuKh/l8ScARDROBjPGCzjwpUUKuE9Nuu 2REgQeQpLV3kq2j3hDnfMD97xOCfEsM= From: Borislav Petkov To: Andy Lutomirski , Masami Hiramatsu Cc: X86 ML , LKML Subject: [PATCH v1 13/19] x86/uprobes: Convert to insn_decode() Date: Wed, 23 Dec 2020 18:42:27 +0100 Message-Id: <20201223174233.28638-14-bp@alien8.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223174233.28638-1-bp@alien8.de> References: <20201223174233.28638-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Simplify code, no functional changes. Signed-off-by: Borislav Petkov --- arch/x86/kernel/uprobes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index a2b413394917..b63cf8f7745e 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -276,12 +276,12 @@ static bool is_prefix_bad(struct insn *insn) static int uprobe_init_insn(struct arch_uprobe *auprobe, struct insn *insn, bool x86_64) { + enum insn_mode m = x86_64 ? INSN_MODE_64 : INSN_MODE_32; u32 volatile *good_insns; + int ret; - insn_init(insn, auprobe->insn, sizeof(auprobe->insn), x86_64); - /* has the side-effect of processing the entire instruction */ - insn_get_length(insn); - if (!insn_complete(insn)) + ret = insn_decode(insn, auprobe->insn, sizeof(auprobe->insn), m); + if (ret < 0) return -ENOEXEC; if (is_prefix_bad(insn)) -- 2.29.2