Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp911414pxb; Fri, 22 Apr 2022 14:06:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw529/AFXM/LXySwws/nNlVqpf9V++AVK4HGh7DL2RyvMbjp5DrjW04j8T62htV0g0HhlmX X-Received: by 2002:a17:902:9307:b0:154:78ba:ed40 with SMTP id bc7-20020a170902930700b0015478baed40mr6616604plb.92.1650661594366; Fri, 22 Apr 2022 14:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650661594; cv=none; d=google.com; s=arc-20160816; b=xWr07nGbceN3EzvItg2sq02SOF60zSI+rvGiP53c8OTwEhTGzw1KpdBW2sJ/HJhd+G xv9TUwy+ZemNLfaN7djvicScR/gnoCTZpwlygHI/LjbLLrZI1QwG3o3TFUYq9noC0CF8 9jNUld1/nc3DLrzJd+fiveh/+kyaSjSJqCbKOM/z442JW0pe4X6czWa/7VE1Z12BEAns 4kCvrvdHxl0BUW4EClC3o/E7qqsk0gtQQmpWgmMbm5nVNPGfpIaD7pTbWfcSRjuBsQNw yVjrxUpIZBVhX4aiA3vp80hHMqj+FZMgZ3zDRXN37JTuE6dcwkxKrMcgSyvifGDd/q1J dEEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=HoYvev3fHg7c2maTUJDkn0h3uWrh1LH/kw0z2Ey0Cbc=; b=wS7h7Pqhtx8XO5x2cLXjT4XXoPe14oIfQ1fb0JxiiEVpncvDmMWSxyXR5ZBXXnpy/t qq+oEFKjTWgufU2HKUMGjfzvUZS18s9IqxgDpMXxQn/QEOUPfKBcyLMMmI4d7FA54K81 w5bp6Ot17VTQl5hfiQKRsFF24AQRRv7Jg42/GD8qh01bh45PpcbUG0ODd6HNkjuVRwkn g59wrJ/wr4XAxgtVP+0ZuOsCP0Cb2v/HKZ2ajAAq/H4k9fY+i4gxVcotq2teZCdWZIEC ORPSAIGqWkXXY6faQVbJXljtw9fIt9pebIsoNLSjeDUSezkubYkxxDs3z1f4fm+cCV7q OC+g== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b9-20020a631b49000000b003aa635c5ff5si9712163pgm.596.2022.04.22.14.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:06:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E58DB32F84E; Fri, 22 Apr 2022 13:03:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445499AbiDVIOn (ORCPT + 99 others); Fri, 22 Apr 2022 04:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232364AbiDVIOf (ORCPT ); Fri, 22 Apr 2022 04:14:35 -0400 Received: from gentwo.de (gentwo.de [161.97.139.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81B0351E5C for ; Fri, 22 Apr 2022 01:11:41 -0700 (PDT) Received: by gentwo.de (Postfix, from userid 1001) id 740E9B00798; Fri, 22 Apr 2022 10:11:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by gentwo.de (Postfix) with ESMTP id 72A4FB00100; Fri, 22 Apr 2022 10:11:38 +0200 (CEST) Date: Fri, 22 Apr 2022 10:11:38 +0200 (CEST) From: Christoph Lameter To: Aaron Tomlin cc: Oleksandr Natalenko , mcgrof@kernel.org, pmladek@suse.com, mbenes@suse.cz, christophe.leroy@csgroup.eu, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, atomlin@atomlin.com, ghalat@redhat.com, neelx@redhat.com Subject: Re: [PATCH v3 2/2] module: Introduce module unload taint tracking In-Reply-To: <20220421145757.zfn6zxh6rx3dp75o@ava.usersys.com> Message-ID: References: <20220420115257.3498300-1-atomlin@redhat.com> <20220420115257.3498300-3-atomlin@redhat.com> <2100545.irdbgypaU6@natalenko.name> <20220421145757.zfn6zxh6rx3dp75o@ava.usersys.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE 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 Thu, 21 Apr 2022, Aaron Tomlin wrote: > > > + if (len == strlen(mod->name) && !memcmp(mod_taint->name, mod->name, len) && > > > > Here, two strings are compared, so I'd expect to see `strncmp()` instead of `memcmp()`. > > Good point. There are other examples of this throughout > kernel/module/main.c; albeit, I will use strncmp() here. Comparing the length first may be an attempt to avoid the expensive memcmp. But here we need to first execute strlen() to obtain the string length. This is already accessing all characters so this check is wasteful and a straight str[n]cmp is better.