Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3273044lfo; Mon, 23 May 2022 00:25:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbIs1utCCB/mJgYxUxjEKi2kosC7Xup0cMpnQTQyC2VQD3GtlwguwjVZA4E0ZthYBUPBYV X-Received: by 2002:a17:903:1249:b0:15e:8b15:b7d2 with SMTP id u9-20020a170903124900b0015e8b15b7d2mr22392869plh.150.1653290733119; Mon, 23 May 2022 00:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653290733; cv=none; d=google.com; s=arc-20160816; b=rlLOg2ujWItgvaJlvU3/iHjZZtw+hYND8jWJHH2ZnoApyIjOJCqdbCiB2nomVgnF4Q u/9mFZhJ7ZkwEbrC4CGZW5Yt3hdGmJ6AdiDo1F1Y6kTiAuFNVwSIs/rO39DZ5Cxuv2Yi wa/36xpMotrm8QcytpJOZF04KC04FJ+CX96IGlHcC9BgGuAFW7qucXEI5tk500x+I4KS TmRqtQ4DqwBNeRnNHt24iiXFthMQ7KxYSdksmHpBeT6IkTPyZYsiJIz8sozq55csOQth h8+VDLE1OJZ6WOcCHpcjkQSI4452aXlsauioBEPNHfE4kv9iFAE15dzqzsHUlUPGe7cS JrEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7VSmTsrf2yRmDPUJj7O4mhbeh8I71iXxthfFzi3aXkY=; b=PGLMs5qfB7Yw55uXMxFmo8y/AWiI/ItFYRHcVfaVQk72udQLf9f0FV3kWQesVpwJDS Sy7fVUG669n/mBLc/WdADyzyKUG/L95c2UhpVQjHLDGefDTcSqpCCqbC2mQyCafw2x0Z GorSLx7JuwdU3XI9CtWMRX7dw+mXzWwsVMultfFibvm/aAoq9NxPDcn8iDN/TrM5hEBn nAhutiHqTb9bOuXM8u3Tq2PQituGZp8kx3kINEtdKtUV/ep0eUyUgsTzg+boVyPu+g2p VN/5xSQvOnNGI8j1ivBn26FZPG7+4TVVLdRb1+UaxyhcS0+TksIJIvzXIQ24TzYAL32r md9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IDKxeJ8S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id gl10-20020a17090b120a00b001dfac44cd1esi11367222pjb.17.2022.05.23.00.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IDKxeJ8S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B2617ED7A0; Sun, 22 May 2022 23:39:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353952AbiETWq6 (ORCPT + 99 others); Fri, 20 May 2022 18:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbiETWq5 (ORCPT ); Fri, 20 May 2022 18:46:57 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2A8AFAE0; Fri, 20 May 2022 15:46:55 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id gi33so9566628ejc.3; Fri, 20 May 2022 15:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7VSmTsrf2yRmDPUJj7O4mhbeh8I71iXxthfFzi3aXkY=; b=IDKxeJ8SiDdIfH863/nqT0j9/oK9RffxHSoBU/YfUbDXzroET4eYNRV1zNCUxEaWnG Pkot+DctHiLZHSYTz17WCwyNwWLNSzhphRyOXbp7mEMH/Oc3vAfXrQ7e9HjTaV7CeG68 SHLv0AIKUUdwf0seJRCjZgNvM1AHSlgRsgPwxlwX3l88C+2TFL4lU1u5IpyhxM57s0hb 03acGg740tRQaowRW+Qs5heTK3Es+GTTDJwJ5faZBiF9W2eDzTMOQUCymSVSElXBl31R jUbpANF3T8Nh0O1Hn1TbalyTbIiNMo0UengQkfo8Nc1gsWFK5p3LNP53QTP5oOKsFJ/k XMNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7VSmTsrf2yRmDPUJj7O4mhbeh8I71iXxthfFzi3aXkY=; b=LU3yUXwmc/+eNNtxI9XRQfwdD41o6Vd9RE4k8pX2gNN57d4Sezz+l/naTpP1qVlMzE ZQE+63rW+mDR3AY/6S+tqsn3dvyT5LfaySIrfoUPXQU2kK3SNDpSE5wX+ZtcZL9ZyzFM yD0VOxwkE8WfMRIEwjubzuBPS0bgvuddaxqVGC0fjtV6QFsYu8vBGMDMpqjOC2eJlaw5 UStAG1GxX3YYdep+Dui6C+i4IlLCUZtrLOpQ/yea9XGDLpv71ujDx37UvEjiE2LN3AgJ Gr4cjEl4Qs6T7Iy07mTkI88pbtL4kesch8MxnCTn9M2HCsUZlLeO57RD2rRwRp404OjU mWFw== X-Gm-Message-State: AOAM532g+01YLCZr/zZd31jrTDghvLKDg2QjsaLW3b4LnYgvmTpIyZYG z4UGWMXOSviUUAhehnvmNUVymkDKUclXkJZaGCI= X-Received: by 2002:a17:906:9753:b0:6fe:aafb:31a6 with SMTP id o19-20020a170906975300b006feaafb31a6mr4663290ejy.502.1653086814409; Fri, 20 May 2022 15:46:54 -0700 (PDT) MIME-Version: 1.0 References: <20220520113728.12708-1-shung-hsi.yu@suse.com> <20220520113728.12708-4-shung-hsi.yu@suse.com> In-Reply-To: <20220520113728.12708-4-shung-hsi.yu@suse.com> From: Alexei Starovoitov Date: Fri, 20 May 2022 15:46:40 -0700 Message-ID: Subject: Re: [PATCH bpf-next 3/4] bpf: verifier: remove redundant opcode checks To: Shung-Hsi Yu Cc: Network Development , bpf , LKML , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 20, 2022 at 4:38 AM Shung-Hsi Yu wrote: > > The introduction of opcode validation with bpf_opcode_in_insntable() in > commit 5e581dad4fec ("bpf: make unknown opcode handling more robust") > has made opcode checks done in do_check_common() and its callees > redundant, so either remove them entirely, or turn them into comments in > places where the redundancy may not be clear. I prefer to keep the existing checks. They help readability on what is actually expected at this point. These checks cost close to nothing in run-time.