Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp244844iob; Mon, 2 May 2022 18:21:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT0hwW2gppW4cOMSmeoiCiBITG7o2s2ErYVgaydPkkcbEdcTiTEBxY7OvmgQ3BWU2n9Myi X-Received: by 2002:a17:90a:bd95:b0:1d9:6735:e9ef with SMTP id z21-20020a17090abd9500b001d96735e9efmr2126653pjr.157.1651540880995; Mon, 02 May 2022 18:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651540880; cv=none; d=google.com; s=arc-20160816; b=AvDnMOjpdgFXAAD+evydsZBrmVITyQ3rEaU1qSYFVZ4nyDNuz89KF7BH1U6QDvNYEl 0U3inPFpsjS43/jOtGq8Qdkoyjyp1m0u4w6ZCOknFzUsZ1dTyTAXX2zE6pLUUMX4NGnJ l3LX/om63HBAxAj1PEQ7rKZTZcOimuwOkX7aRR9n6temlHgVXh6oqNsxNHpfVo5eCMaf IyHzUHP/729WClo9IyfcwydlxKofAwC1+cH9PIIx99/u3PV0odAzEVi9iLT9+QPm8OZ+ IQhFpthlenErLQ9XNoWaXVI8adI72uC0Y2pgn/e7+sjtUBwUF04n9JNCJ1f0JiPweRZa AG2g== 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=YnpbZs50SiOUxfAVjbV2pZV2prkPBtBeiEirw1AUs2U=; b=z5Xm3nicnwWy0rQ1HcHI2ejOT1vWUrTDsF5+HJdT/teQ59E71uLqwghCmc3rbptM8E mOqA6GDIYeUXos+KtqcEbvNNouaC18l4vhYCtTyjJ/wV+s7uGJlQ+R3x/UbYElSNBb/Q SNM4k24rEXERncXUYIz/t0wpLanYBA/kw/SCa4Ik1cRNHcIP5itr+6dXMBa1u2CXkoSC g+/1moriBSwtYazx6NzLcmoEKudGHGZqHkAVQY2+51X4asj9dr4TBPaxP/JkDEHHY4fn eZHk6Jsfmga2lwi/WQMRaSCjXVRwmtgLu4DNxGX6c9vjFDrKBJwJnuN/8+ZmY/3xsNTm zBcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GcYRAQuM; 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 z7-20020a170903018700b0015682b8c0b3si7073151plg.469.2022.05.02.18.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:21:20 -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=GcYRAQuM; 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 572ABF07; Mon, 2 May 2022 18:00:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353347AbiEBStN (ORCPT + 99 others); Mon, 2 May 2022 14:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387018AbiEBStF (ORCPT ); Mon, 2 May 2022 14:49:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE7E8B7CA for ; Mon, 2 May 2022 11:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651517135; 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=YnpbZs50SiOUxfAVjbV2pZV2prkPBtBeiEirw1AUs2U=; b=GcYRAQuMd7R5PUji1Fd4P7AmBzSZVEtNz2fXHV0i/K6QSB2t+tsOsa03ot4QSCKnmxxwzv l/WT4fbXSQoolF1lhBdqeUyNnYkzGM7KnxrAm++9uiUmYaobjmZxgfcuIPU+L89BXMe7Go k4bktLUhAt2zMcZ9hAeI/gw+FH9sxAg= 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-622-nj22mpb1NO6Gfw_0Sqr2BQ-1; Mon, 02 May 2022 14:45:33 -0400 X-MC-Unique: nj22mpb1NO6Gfw_0Sqr2BQ-1 Received: by mail-wr1-f71.google.com with SMTP id g7-20020adfbc87000000b0020ac76d254bso5592367wrh.6 for ; Mon, 02 May 2022 11:45:33 -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=YnpbZs50SiOUxfAVjbV2pZV2prkPBtBeiEirw1AUs2U=; b=dFG6n5mc7GEJEWx/KvadE9QVORbeTWLqKwnSLmAGzG9RYS+X6BMGFr945w8aG1WdRP VCcB7SZDhN8g5hTFjhvj5N43VCp/rdUcGo5Gepbp+8cKGPClVrO1bz8pKrWocv4yePQ3 12zK7dWcrFTSjq8o2BI+OBtLKFMeI3aljhCYEtIaP61f+xc1yt0ldxrsVpKp64FlxpaI UglmUpeX3l7XjQecaN+Mdm5bioO+1p1+RGwdsnY3h/TNKM5jfxxzEhf8UlHIS6UkQCp7 cXF8aM4fvHFpx6zRtaIeUBKsKWkrUY9BBdTXVm8///dwBh6dRnlmi/fLcDQaq4TL2a9U YanQ== X-Gm-Message-State: AOAM531wZvFaT5DO2q3bkvhX6wBxC6ZTUAVM8UssIasoMejC8vseOhNF lorExl1Zxmz1PNiztqrOj+WmDmHnJoXjicnGDjV7Ap3IxO7pn/iPOn/FYML5a1/RRNBxscKruOB 8ejqpge3Mk+e8FdsU0C9poAQ= X-Received: by 2002:adf:de04:0:b0:20a:da05:39b with SMTP id b4-20020adfde04000000b0020ada05039bmr10116696wrm.550.1651517132776; Mon, 02 May 2022 11:45:32 -0700 (PDT) X-Received: by 2002:adf:de04:0:b0:20a:da05:39b with SMTP id b4-20020adfde04000000b0020ada05039bmr10116681wrm.550.1651517132544; Mon, 02 May 2022 11:45:32 -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 l12-20020adfbd8c000000b0020c5253d8edsm7822588wrh.57.2022.05.02.11.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 11:45:31 -0700 (PDT) Date: Mon, 2 May 2022 19:45:30 +0100 From: Aaron Tomlin To: Christophe Leroy Cc: "mcgrof@kernel.org" , "cl@linux.com" , "pmladek@suse.com" , "mbenes@suse.cz" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linux-modules@vger.kernel.org" , "atomlin@atomlin.com" , "ghalat@redhat.com" , "oleksandr@natalenko.name" , "neelx@redhat.com" Subject: Re: [PATCH v4 2/2] module: Introduce module unload taint tracking Message-ID: <20220502184530.qjbl7rkilmxtmsgg@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: <20220425090841.3958494-1-atomlin@redhat.com> <20220425090841.3958494-3-atomlin@redhat.com> <73869e4f-7190-221c-897b-fc13ec54c8cb@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <73869e4f-7190-221c-897b-fc13ec54c8cb@csgroup.eu> X-Spam-Status: No, score=-2.6 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,T_SCC_BODY_TEXT_LINE 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 Mon 2022-05-02 11:07 +0000, Christophe Leroy wrote: > > @@ -150,6 +160,41 @@ int unregister_module_notifier(struct notifier_block *nb) > > } > > EXPORT_SYMBOL(unregister_module_notifier); > > > > +#ifdef CONFIG_MODULE_UNLOAD_TAINT_TRACKING > > +static int try_add_tainted_module(struct module *mod) > > +{ > > + struct mod_unload_taint *mod_taint; > > + > > + module_assert_mutex_or_preempt(); > > + > > + list_for_each_entry_rcu(mod_taint, &unloaded_tainted_modules, list, > > + lockdep_is_held(&module_mutex)) { > > + size_t len = strlen(mod_taint->name); > > Why do you need that strlen() at all, can't you just use strcmp() ? > With strncmp() what happens if for instance mod_taint->name is "dead" > and mod->name is "deadbeef" ? Hi Christophe, Thanks for your feedback. I see that. Furthermore, the length of a module's name is fixed. Hence strcmp() should be fine. Kind regards, -- Aaron Tomlin