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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 26 Aug 2011 11:44:12 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Don Zickus <dzickus@...hat.com>
Cc:	x86@...nel.org, Andi Kleen <andi@...stfloor.org>,
	Robert Richter <robert.richter@....com>, ying.huang@...el.com,
	LKML <linux-kernel@...r.kernel.org>, paulmck@...ux.vnet.ibm.com
Subject: Re: [V3][PATCH 2/6] x86, nmi: create new NMI handler routines

On Thu, 2011-08-25 at 12:45 -0400, Don Zickus wrote:
> +static int __setup_nmi(unsigned int type, struct nmiaction *action)
> +{
> +       struct nmi_desc *desc = nmi_to_desc(type);
> +       struct nmiaction **a = &(desc->head);
> +       unsigned long flags;
> +
> +       spin_lock_irqsave(&desc->lock, flags);
> +
> +       /*
> +        * some handlers need to be executed first otherwise a fake
> +        * event confuses some handlers (kdump uses this flag)
> +        */
> +       if (!(action->flags & NMI_FLAG_FIRST))
> +               while ((*a) != NULL)
> +                       a = &((*a)->next);
> +       
> +       action->next = *a;
> +       rcu_assign_pointer(*a, action);
> +
> +       spin_unlock_irqrestore(&desc->lock, flags);
> +       return 0;
> +}
> +
> +static struct nmiaction *__free_nmi(unsigned int type, const char *name)
> +{
> +       struct nmi_desc *desc = nmi_to_desc(type);
> +       struct nmiaction *n, **np = &(desc->head);
> +       unsigned long flags;
> +
> +       spin_lock_irqsave(&desc->lock, flags);
> +
> +       while ((*np) != NULL) {
> +               n = *np;
> +
> +               /*
> +                * the name passed in to describe the nmi handler
> +                * is used as the lookup key
> +                */
> +               if (!strcmp(n->name, name)) {
> +                       WARN(in_nmi(),
> +                               "Trying to free NMI (%s) from NMI context!\n", n->name);
> +                       rcu_assign_pointer(*np, n->next);
> +                       break;
> +               }
> +               np = &(n->next);
> +       }
> +
> +       spin_unlock_irqrestore(&desc->lock, flags);
> +       synchronize_rcu();
> +       return (*np);
> +} 

Probably not worth fixing, but if someone was silly enough to register
with an already existing name we're up shit creek, right? :-)
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ