lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEXW_YQbSySm++iXeXn7uMdGVatCKo88L5WXecL2=WkJg7XDEg@mail.gmail.com>
Date:   Tue, 7 Mar 2023 00:32:40 -0500
From:   Joel Fernandes <joel@...lfernandes.org>
To:     Joe Perches <joe@...ches.com>
Cc:     linux-kernel@...r.kernel.org, Andy Whitcroft <apw@...onical.com>,
        Dwaipayan Ray <dwaipayanray1@...il.com>,
        Lukas Bulwahn <lukas.bulwahn@...il.com>,
        "Paul E. McKenney" <paulmck@...nel.org>, RCU <rcu@...r.kernel.org>,
        Oleksiy Avramchenko <oleksiy.avramchenko@...y.com>,
        Jens Axboe <axboe@...nel.dk>,
        Philipp Reisner <philipp.reisner@...bit.com>,
        Bryan Tan <bryantan@...are.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Bob Pearson <rpearsonhpe@...il.com>,
        Ariel Levkovich <lariel@...dia.com>,
        "Theodore Ts'o" <tytso@....edu>, Julian Anastasov <ja@....bg>,
        Uladzislau Rezki <urezki@...il.com>
Subject: Re: [PATCH] checkpatch: Error out if deprecated RCU API used

On Tue, Mar 7, 2023 at 12:22 AM Joe Perches <joe@...ches.com> wrote:
>
> On Tue, 2023-03-07 at 00:11 -0500, Joel Fernandes wrote:
>
> > Do you mind sharing which tree you are looking at? I checked both
> > 6.3-rc1 and linux-next.
> >
> > Your grep returned:
> >
> > kernel/trace/trace_osnoise.c:   kvfree_rcu(inst);
> > kernel/trace/trace_probe.c:     kvfree_rcu(link);
> > lib/test_vmalloc.c:             kvfree_rcu(p);
> > mm/list_lru.c:   * We need kvfree_rcu() here. And the walking of the list
> > net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */
> > net/core/sysctl_net_core.c:
> > kvfree_rcu(orig_sock_table);
> > net/core/sysctl_net_core.c:                             kfree_rcu(cur);
> > net/mac802154/scan.c:   kfree_rcu(request);
> > net/mac802154/scan.c:   kfree_rcu(request);
>
> rather old.  I'm not subscribed and haven't been following much.
>
> Add linux-next specific files for 20230217

I am surprised though why you don't see the usage in trace_osnoise.c
though because that was added in 2021 (see diff below).

Anyway, I take it you are Ok with the checkpatch patch. If so, do
provide your Ack tag in advance. We can push from our side only if
needed. There is a chance that we may not need it if we are successful
in having made the conversions to the "good API" in time for the next
merge window.

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 7520d43aed55..4719a848bf17 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -138,8 +138,7 @@ static void osnoise_unregister_instance(struct
trace_array *tr)
        if (!found)
                return;

-       synchronize_rcu();
-       kfree(inst);
+       kvfree_rcu(inst);
 }

 /*


>
> Updating to today's next:
>
> Add linux-next specific files for 20230307
>
> I get several instances:
>
> $ git grep -P '\bkv?free_rcu\s*\(' -- '*.[ch]' | grep -v -P 'kv?free_rcu\s*\([^,]+,.*\)'
> drivers/block/drbd/drbd_nl.c:   kvfree_rcu(old_disk_conf);
> drivers/block/drbd/drbd_nl.c:   kvfree_rcu(old_net_conf);
> drivers/block/drbd/drbd_nl.c:           kvfree_rcu(old_disk_conf);
> drivers/block/drbd/drbd_receiver.c:     kvfree_rcu(old_net_conf);
> drivers/block/drbd/drbd_receiver.c:                     kvfree_rcu(old_disk_conf);
> drivers/block/drbd/drbd_state.c:                kvfree_rcu(old_conf);
> drivers/infiniband/core/device.c:               kfree_rcu(container_of(dev->port_data, struct ib_port_data_rcu,
> drivers/infiniband/core/rdma_core.c:     * kfree_rcu(). However the object may still have been released and
> drivers/infiniband/sw/rxe/rxe_mr.c:     kfree_rcu(mr);
> drivers/misc/vmw_vmci/vmci_context.c:           kvfree_rcu(notifier);
> drivers/misc/vmw_vmci/vmci_event.c:     kvfree_rcu(s);
> drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c:       kfree_rcu(int_port);
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:      kfree_rcu(tx_sa);
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:      kfree_rcu(rx_sc);
> drivers/target/target_core_configfs.c:                   * callbacks to complete post kfree_rcu(), before allowing
> fs/ext4/super.c:                                kfree_rcu(qname);
> include/linux/rcupdate.h: *     kvfree_rcu(ptr);
> include/linux/rcupdate.h:#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__,          \
> include/linux/rcutiny.h:        // kvfree_rcu(one_arg) call.
> include/rdma/ib_verbs.h:        struct rcu_head         rcu;            /* kfree_rcu() overhead */
> include/scsi/scsi_device.h: * @rcu: For kfree_rcu().
> kernel/rcu/rcuscale.c:          pr_alert("CONFIG_RCU_LAZY is disabled, falling back to kfree_rcu() for delayed RCU kfree'ing\n");
> kernel/rcu/tree.c: * struct kvfree_rcu_bulk_data - single block to store kvfree_rcu() pointers
> kernel/rcu/tree.c: * @records: Array of the kvfree_rcu() pointers
> kernel/rcu/tree.c: * struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests
> kernel/rcu/tree.c: * @head_free: List of kfree_rcu() objects waiting for a grace period
> kernel/rcu/tree.c: * @bulk_head_free: Bulk-List of kvfree_rcu() objects waiting for a grace period
> kernel/rcu/tree.c: * struct kfree_rcu_cpu - batch up kfree_rcu() requests for RCU grace period
> kernel/rcu/tree.c: * @head: List of kfree_rcu() objects not yet waiting for a grace period
> kernel/rcu/tree.c: * @bulk_head: Bulk-List of kvfree_rcu() objects not yet waiting for a grace period
> kernel/rcu/tree.c: * @krw_arr: Array of batches of kfree_rcu() objects waiting for a grace period
> kernel/rcu/tree.c:       * double-argument of kvfree_rcu().  This happens when the
> kernel/rcu/tree.c: * reduce the number of grace periods during heavy kfree_rcu()/kvfree_rcu() load.
> kernel/rcu/tree.c:              // Probable double kfree_rcu(), just leak.
> kernel/trace/trace_osnoise.c:   kvfree_rcu(inst);
> kernel/trace/trace_probe.c:     kvfree_rcu(link);
> net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */
> net/core/sysctl_net_core.c:                             kvfree_rcu(orig_sock_table);
> net/core/sysctl_net_core.c:                             kfree_rcu(cur);
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ