Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp861749pxb; Fri, 22 Apr 2022 12:53:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu3lOPkk7arfK06GVgq5h/RpVdlv2HkW7urEeZ0t7UKgTm3erEfCXrsBGuHKhcFB3TGUIp X-Received: by 2002:a17:902:d70a:b0:158:7f07:e7c9 with SMTP id w10-20020a170902d70a00b001587f07e7c9mr6164257ply.109.1650657198777; Fri, 22 Apr 2022 12:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650657198; cv=none; d=google.com; s=arc-20160816; b=ChzIGeA5/CnHNzw2Ulp2UzPj428lKFGvVXSja35qeJY50vev9GkHV7+18cq/hE+lLY h5lnkfM50qh1kgGHMieckMkGnQ1Uf9n3ez+2C+jHzgZt1X6o+uxq9yTMn3b5a3lA1wkb sCxv7nwigrsSJ+oqGzbrxsZJAAW/c2CdsZ7YDCe07PBvCI77z4W6DR3nV4wb0f0HZtaL UtHBy4c7HrtmZWKBzpvYb0FLJNwQJpomA5JZ0d6W93pqQPK3ad6RmtU6spxRIi/xfnhm Se2UbdmN/2URlrrNuBz2f7MpcX8Uvs7CDbjVPSK1Loq3B84+EY3Au9IaEHFjttgiJffB f93Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=njebc7Dm0AoMVQ2bbp0IWL/4+XRs/wUKBlW88zEnLjs=; b=XoLwK6vYkwSCrOdiFo9aFTzV4Ihp5oFY3Dwa+UXdqjJH9gIuXxjC8filAl3tvrL69k KUmU0HSd0WMsVAGqPVhwL+y3B/wqWnGiQbf8e4DMxw13hxwJGYBOzYkoLoZiFqE+lUKz 1HmSkEAJPBTQvfP4onGugO4fgn78nCe3vdJh/9d/HIZ9pGfM3mfCXPGBr+3oWSNNqwDX aTSUwoNSl4s/tYdnClW/VtVsaABSEEOWLNDAZPfCn8jvKHUnxUkpCUiPRQ5VnDuy2G3A h3ctcQBwoYr3ADMlOLMW3SQ7S/cum1W4RtdjiSFtfXjv8vDwxoOuzlVhmYxGYYQnQEPm gq3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d3HWAna1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s7-20020a170902ea0700b00156a03969e8si9392144plg.307.2022.04.22.12.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:53:18 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d3HWAna1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B74E41816D5; Fri, 22 Apr 2022 11:54:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447417AbiDVM0E (ORCPT + 99 others); Fri, 22 Apr 2022 08:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447372AbiDVM0C (ORCPT ); Fri, 22 Apr 2022 08:26:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 19CFE5677E for ; Fri, 22 Apr 2022 05:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650630189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=njebc7Dm0AoMVQ2bbp0IWL/4+XRs/wUKBlW88zEnLjs=; b=d3HWAna1E7t6EHqzLJe5kv9AaGgx0s1WDQ1EEaONEOC0YL6VKDRowNvYGbEckdfJxoA86K b5/hlvvanlzvZzEhempY5rZo4LZ45hBibdQQdZOW5nCUEQ1GQ1MzfeOPWuWmCnE4/Iajdb +6rtf7AvXwIh51omSARSt56pfyyWVL0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-ZSCQ_Gp0PpSJgN3d7El80w-1; Fri, 22 Apr 2022 08:23:08 -0400 X-MC-Unique: ZSCQ_Gp0PpSJgN3d7El80w-1 Received: by mail-wr1-f71.google.com with SMTP id v21-20020adfa1d5000000b0020a80b3b107so1864641wrv.0 for ; Fri, 22 Apr 2022 05:23:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=njebc7Dm0AoMVQ2bbp0IWL/4+XRs/wUKBlW88zEnLjs=; b=OVFjlqF3z2nK4nDCwF3HjwC9izoLfD7bG7KyLAmcnJXu2P7zQ10PDtXMpyVJWjdRsX DXo9lV0P8tgziDtoC5IwvCh41/zekMc4WrTRHYkgkiEDsIgP/GyvhhbIRFWx/AGv8Yn+ rv8yP5YHNobwQKrwavZwPZ+NZABWVlUnmqNEYDtmSIbQI0KDLLDrVYrHfN16/Z5hvHv5 yrM/CD+8n4IYIHHOxBN6EBPHpv6sqHsDaWFEwxfbg5fgXSI+OvX4BZftjLZ8v4fd82Nn bjZAy8/jNti3QAGTh0axSE5sleI3fX+Rb6CaQdL4K+stRXDNxGacpvsT/VxlkWG46oGx ahSw== X-Gm-Message-State: AOAM533ZkoyC2o8J3i6UZ6N7Cgg9Exu6mHgnMsxGmeF3KYz+rvM9lOw8 jH48huUqkr4Xs/FvY2pTpnq08gw0TcnF5620aOPMoYABswCJ34Y5mNbppWiKrPOMSGzTL+kxfJE +1Q/s1qpoTYwDJD2QsJLaVq0= X-Received: by 2002:adf:e887:0:b0:20a:c52f:e01a with SMTP id d7-20020adfe887000000b0020ac52fe01amr3605311wrm.42.1650630186919; Fri, 22 Apr 2022 05:23:06 -0700 (PDT) X-Received: by 2002:adf:e887:0:b0:20a:c52f:e01a with SMTP id d7-20020adfe887000000b0020ac52fe01amr3605289wrm.42.1650630186697; Fri, 22 Apr 2022 05:23:06 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id p3-20020a5d59a3000000b0020a83f00487sm2357447wrr.9.2022.04.22.05.23.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 05:23:05 -0700 (PDT) Date: Fri, 22 Apr 2022 13:23:03 +0100 From: Aaron Tomlin To: Christoph Lameter 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 Message-ID: <20220422122303.6lbcrknnbs6vsgr6@ava.usersys.com> X-PGP-Key: http://pgp.mit.edu/pks/lookup?search=atomlin%40redhat.com X-PGP-Fingerprint: 7906 84EB FA8A 9638 8D1E 6E9B E2DE 9658 19CC 77D6 References: <20220420115257.3498300-1-atomlin@redhat.com> <20220420115257.3498300-3-atomlin@redhat.com> <2100545.irdbgypaU6@natalenko.name> <20220421145757.zfn6zxh6rx3dp75o@ava.usersys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 2022-04-22 10:11 +0200, Christoph Lameter wrote: > 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. Hi Christoph, Agreed - we can skip the extra strlen(). Thanks, -- Aaron Tomlin