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]
Message-ID: <20181120142306.GX2131@hirez.programming.kicks-ass.net>
Date:   Tue, 20 Nov 2018 15:23:06 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Frederic Weisbecker <frederic@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Wanpeng Li <wanpengli@...cent.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yauheni Kaliuta <yauheni.kaliuta@...hat.com>,
        Ingo Molnar <mingo@...nel.org>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH 20/25] sched/kcpustat: Introduce vtime-aware kcpustat
 accessor

On Wed, Nov 14, 2018 at 03:46:04AM +0100, Frederic Weisbecker wrote:

> +void kcpustat_cputime(struct kernel_cpustat *kcpustat, int cpu,
> +		      u64 *user, u64 *nice, u64 *system,
> +		      u64 *guest, u64 *guest_nice)
> +{
> +	struct task_struct *curr;
> +	struct vtime *vtime;
> +	int err;
> +
> +	if (!vtime_accounting_enabled()) {
> +		kcpustat_cputime_raw(kcpustat, user, nice,
> +				     system, guest, guest_nice);
> +		return;
> +	}
> +
> +	rcu_read_lock();
> +
> +	do {
> +		curr = rcu_dereference(kcpustat->curr);

Like I explained earlier; I don't think the above is correct.
task_struct is itself not RCU protected.

> +		if (!curr) {
> +			kcpustat_cputime_raw(kcpustat, user, nice,
> +					     system, guest, guest_nice);
> +			break;
> +		}
> +
> +		vtime = &curr->vtime;
> +		err = kcpustat_vtime(kcpustat, vtime, cpu, user,
> +				     nice, system, guest, guest_nice);
> +	} while (err == -EAGAIN);
> +
> +	rcu_read_unlock();
> +}
> +
>  #endif /* CONFIG_VIRT_CPU_ACCOUNTING_GEN */
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ