From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D490C55178 for ; Wed, 21 Oct 2020 14:26:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B38A2222C8 for ; Wed, 21 Oct 2020 14:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603290379; bh=l35jTotqmPVpGqH3vFD7Rm4q/ta0Ol+Pocoe3l+xzZk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=CUzkkGTkZjZQ7ZMtVrm7Mu5cmqhjduI0wpkaxUIWGqsvK0723uwaWEDhKk7VrCTEy f3pvW1BuVRC46v1AsFKnkw3m2oi4Hnry1u1rfEPUPia7vsbS3cELN8PQlYARYU39qi Dqp9IYSSXlhuY/472JVKJIyv4cwbet690Vn8E9fI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2443479AbgJUO0S (ORCPT ); Wed, 21 Oct 2020 10:26:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:47826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395019AbgJUO0S (ORCPT ); Wed, 21 Oct 2020 10:26:18 -0400 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E2912224E; Wed, 21 Oct 2020 14:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603290377; bh=l35jTotqmPVpGqH3vFD7Rm4q/ta0Ol+Pocoe3l+xzZk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FLElJiCfd/SO4lEx/Ikc9/UFCRupmdwtM/+ReBybVLucQIbBk+D82xsmKiqKGKtNu 2lL+X7GKJ/15W2kbfJbspgXu1MGlAh34VYRGGPRfLeyqSpj/gwrGuOKzTUjnJimWJe ZMFuC2PauCD+4A49wEgQXHMpFtttcvTHVFzwMeUE= Date: Wed, 21 Oct 2020 23:26:13 +0900 From: Masami Hiramatsu To: Borislav Petkov Cc: x86-ml , Joerg Roedel , lkml Subject: Re: [RFC] Have insn decoder functions return success/failure Message-Id: <20201021232613.e40c1daef4b567e0e29044a4@kernel.org> In-Reply-To: <20201021092750.GA4050@zn.tnic> References: <20201020120232.GD11583@zn.tnic> <20201020232700.5510c236d810b7f8a66779e2@kernel.org> <20201020143746.GG11583@zn.tnic> <20201021095013.d82637f84af564ae4363189d@kernel.org> <20201021092750.GA4050@zn.tnic> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Oct 2020 11:27:50 +0200 Borislav Petkov wrote: > On Wed, Oct 21, 2020 at 09:50:13AM +0900, Masami Hiramatsu wrote: > > Agreed. So I'm OK for returning the result of "decoding". > > But we also need to note that the returning success doesn't > > mean the instruction is valid. That needs another validator. > > > ... > > > > > Yes, so let's add the return value (with a note, so that someone > > does not try to use it for validation). > > Ok, I'm unclear on that "validation" you talk about. What exactly do > you mean? Can you give an example of how one would determine whether an > instruction is valid? And valid how? Hmm, I meant someone might think it can be used for filtering the instruction something like, insn_init(insn, buf, buflen, 1); ret = insn_get_length(insn); if (!ret) { /* OK, this is safe */ patch_text(buf, trampoline); } No, we need another validator for such usage. Thank you, > > Thx. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette -- Masami Hiramatsu