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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 3 Jul 2011 10:37:59 +0200
From:	Bart Van Assche <bvanassche@....org>
To:	Jim Cromie <jim.cromie@...il.com>
Cc:	linux-kernel@...r.kernel.org, gnb@...h.org, jbaron@...hat.com,
	gregkh@...e.de
Subject: Re: [PATCH 10/11] dynamic_debug: call apply_pending_queries from ddebug_add_module

On Tue, Jun 28, 2011 at 9:09 AM, Jim Cromie <jim.cromie@...il.com> wrote:
> +/* apply matching queries in pending-queries list */
> +static void apply_pending_queries(struct ddebug_table *dt)
> +{
> +       struct pending_query *pq, *pqnext;
> +       int nfound;
> +
> +       if (verbose)
> +               pr_info("pending_ct: %d\n", pending_ct);
> +
> +       list_for_each_entry_safe(pq, pqnext, &pending_queries, link) {
> +
> +               if (verbose)
> +                       pr_info("check: %s <-> %s\n",
> +                               dt->mod_name, show_pending_query(pq));
> +
> +               nfound = ddebug_change(&pq->query, pq->flags, pq->mask);
> +
> +               if (nfound) {
> +                       mutex_lock(&ddebug_lock);
> +                       list_del(&pq->link);
> +                       mutex_unlock(&ddebug_lock);
> +                       kfree(pq);
> +                       pending_ct--;
> +               }
> +               else if (verbose)
> +                       pr_info("no-match: %s\n", show_pending_query(pq));
> +       }

The above code doesn't look thread-safe to me. List walking, list
deletion and pending_ct manipulation all should be protected by the
ddebug_lock mutex instead of only list deletion.

Also, why to remove pending entries once a match has been found ? The
resulting behavior will be that when unloading and reloading a kernel
module repeatedly that only the first time a kernel module is loaded
the matching dynamic debug statements in the loaded module will be
enabled.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists