Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 19 Sep 2011 11:32:24 -0700
From: Linus Torvalds <>
To: Andi Kleen <>
Cc: Balbir Singh <>, Vasiliy Kulikov <>, 
	Shailabh Nagar <>,,, 
	Eric Paris <>, Stephen Wilson <>, 
	KOSAKI Motohiro <>, David Rientjes <>, 
	Andrew Morton <>, Balbir Singh <>,
Subject: Re: [Security] [PATCH 2/2] taskstats: restrict access to user

On Mon, Sep 19, 2011 at 11:29 AM, Andi Kleen <> wrote:
>>  #define KB 1024
> Needs to be 1024ULL, because the counters are 64bit.
>>  #define MB (1024*KB)
>> +#define KB_MASK (~(KB-1))
> Otherwise you lose the upper 32bits here.

No, it's an "int" constant, so it will sign-extend properly when it
gets extended to 64 bits.

It's "unsigned int" etc that can be dangerous in these kinds of situations.

(Of course, in other contexts, sign-extensions of masks is *bad*. So
it depends on what you do)


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.