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-next>] [day] [month] [year] [list]
Date:	Fri, 21 Mar 2008 16:46:09 +0100
From:	"Francis Moreau" <francis.moro@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: Question about C language.

Hello,

I know it's a bit out of topic but this is something I need to clarify for
writing a Linux driver... hope you don't mind.

In my driver I have a global variable that controls a loop such as:

int my_condition;

void change_my_condition(int new)
{
    my_condition = new;
}

int foo(void)
{
    /* irqs are disabled */
    my_condition = 1;
    do {
        ....
        local_irq_enable();
        cpu_sleep();
        local_irq_disable();

   } while (my_condition);

}

This variable is modified by an interrupt handler define in another file
by using 'change_my_condition' function.

By reading the ISO C99 specification, I _think_ that I needn't any
kind of barrier
or even use the volatile type qualifier for my_condition variable to make a true
access to 'my_condition' in the controlling expression of the while, but I'm not
sure.

Coud anybody confirm ?

Thanks,
-- 
Francis
--
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