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:	Wed, 27 May 2009 19:36:32 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Chris Friesen <cfriesen@...tel.com>
cc:	LKML <linux-kernel@...r.kernel.org>,
	Ulrich Drepper <drepper@...hat.com>,
	Roland McGrath <roland@...hat.com>
Subject: Re: linux missing support for _POSIX_THREAD_CPUTIME?

On Wed, 27 May 2009, Chris Friesen wrote:

> Thomas Gleixner wrote:
> > On Wed, 27 May 2009, Chris Friesen wrote:
> > 
> > That's more a question for the glibc folks. CC'ed.
> 
> Actually, I'm looking at the kernel code here.  It looks like
> posix_cpu_clock_get() should be able to handle a per-task cpu clock for
> another thread within the same process.  However, it's only ever called
> by thread_cpu_clock_get(), which hardcodes a clock_id of THREAD_CLOCK,
> which corresponds to the current thread.

No, it's also called via the CLOCK_DISPATCH magic in posix_timers.c
 
> Similarly, invalid_clockid() will say that the clock_id is invalid if
> it's positive but greater than 15.  If my math is right, this means that
> any pid > 2 will result in invalid_clockid() failing.

posix_cpu_clock_get() does:

  const pid_t pid = CPUCLOCK_PID(which_clock);

CPUCLOCK_PID is defined as:

#define CPUCLOCK_PID(clock)  ((pid_t) ~((clock) >> 3))

include/linux/posix-timers.h has the helper macros to build the
clock_id value for posix_cpu_clock_get()

#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
        ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
#define MAKE_THREAD_CPUCLOCK(tid, clock) \
        MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)

Hope that helps,

     tglx
--
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