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:	Tue, 4 Sep 2012 16:29:27 +0530
From:	Manavendra Nath Manav <mnm.kernel@...il.com>
To:	Julian Andres Klode <jak@...-linux.org>
Cc:	kernelnewbies@...nelnewbies.org, devel@...verdev.osuosl.org,
	Greg KH <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, alan@...rguk.ukuu.org.uk
Subject: Re: Why exported const value modified by another driver not updated
 in original driver

On Tue, Sep 4, 2012 at 4:09 PM, Julian Andres Klode <jak@...-linux.org> wrote:
> On Tue, Sep 04, 2012 at 03:58:20PM +0530, Manavendra Nath Manav wrote:
>> On Tue, Sep 4, 2012 at 3:00 PM, Manavendra Nath Manav
>> <mnm.kernel@...il.com> wrote:
>> > Hi,
>> >
>> > I have declared a static const int variable in one driver and exported
>> > that variable symbol. In another driver i am modifying that variable.
>
> No, you did not export it. It's static (and static is kind of the opposite
> of extern). And then you try to assign a value to a non-static variable with
> the same name, which might not even exist (as the other is static, this should
> not even work in my opinion).
>
>> > The other driver prints the modified value but the original driver
>> > retains the original value. When both virtual and physical addresses
>> > of the variable as seen by both drivers are same, how is this even
>> > possible. Is it a kernel bug?
>
> It only works because the compiler optimized the value = 123 away,
> and replaced value with 123 in the first module everywhere, as it
> is declared const and thus cannot be changed, so there's no reason
> to read it from memory.
>
> --
> Julian Andres Klode  - Debian Developer, Ubuntu Member
>
> See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Still I am not able to understand !! Why the output behaviour changes
when the declaration is made as "const volatile". I get the same
results as above when i remove "static" and retain "const".
-- 
Manavendra Nath Manav
--
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