Re: [PATCH] allow context attribute on variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg wrote:
> This patch makes it possible to add the context attribute on
> variables, to warn for example in this case:
> 
>     struct something {
>         int x __attribute__((context(L,1,1)));
>     };
> 
>     extern struct something *s;
> 
>     static void warn_access13(void)
>     {
>         s->x = 7;
>     }
> 
> This is achieved by translating the context attribute on
> variables that are loaded from/stored to into a context
> expression internally. A number of tests are included,
> including tests for a struct member (as above) and array
> accesses.
> 
> Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> ---
> I didn't see any need for distinguishing between rd/wr nor
> for a new attribute, so I just used the one we already have.
> 
> The exact_context() attribute is also allowed so we have the
> same max/no-max semantics as functions.
> 
> If read/write is necessary to distinguish (I don't see a use
> case) then we can do that fairly easily later.

I like the idea of matching the existing attributes as closely as
possible.  However, RCU provides a use case for distinguishing readers
and writers: you might have a variable that you can read if you hold
the RCU reader "lock", but you can only write if you hold a spinlock.

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux