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:   Sun, 30 Oct 2016 19:13:59 -0600 (MDT)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Fenghua Yu <fenghua.yu@...el.com>
cc:     Ingo Molnar <mingo@...e.hu>,
        "H. Peter Anvin" <h.peter.anvin@...el.com>,
        Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...e.de>,
        Stephane Eranian <eranian@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Dave Hansen <dave.hansen@...el.com>,
        David Carrillo-Cisneros <davidcc@...gle.com>,
        Ravi V Shankar <ravi.v.shankar@...el.com>,
        Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
        Sai Prakhya <sai.praneeth.prakhya@...el.com>,
        Nilay Vaish <nilayvaish@...il.com>, Shaohua Li <shli@...com>,
        linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v6 03/10] x86/intel_rdt: Add basic resctrl filesystem
 support

On Fri, 28 Oct 2016, Fenghua Yu wrote:
> +static void l3_qos_cfg_update(void *arg)
> +{
> +	bool *enable = arg;
> +
> +	wrmsrl(IA32_L3_QOS_CFG, *enable);
> +}
> +
> +static int set_l3_qos_cfg(struct rdt_resource *r, bool enable)
> +{
> +	cpumask_var_t cpu_mask;
> +	struct rdt_domain *d;
> +	int cpu;
> +
> +	if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL))
> +		return -ENOMEM;
> +
> +	list_for_each_entry(d, &r->domains, list) {
> +		/* Pick one CPU from each domain instance to update MSR */
> +		cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
> +	}
> +	cpu = get_cpu();
> +	/* Update QOS_CFG MSR on this cpu if it's in cpu_mask. */
> +	if (cpumask_test_cpu(cpu, cpu_mask))
> +		l3_qos_cfg_update(r);

I made this &enable .....

> +	/* Update QOS_CFG MSR on all other cpus in cpu_mask. */
> +	smp_call_function_many(cpu_mask, l3_qos_cfg_update, &enable, 1);
> +	put_cpu();
> +	if (rdt_resources_all[RDT_RESOURCE_L3DATA].enabled &&
> +	    rdt_resources_all[RDT_RESOURCE_L3CODE].enabled) {
> +		ret = set_l3_qos_cfg(&rdt_resources_all[RDT_RESOURCE_L3], true);
> +		if (ret) {
> +			dentry = ERR_PTR(ret);
> +			goto out;
> +		}
> +	}
> +
> +	dentry = kernfs_mount(fs_type, flags, rdt_root,
> +			      RDTGROUP_SUPER_MAGIC, NULL);
> +	if (IS_ERR(dentry))
> +		goto out;

This leaks a potentially enabled cdp. So if you mount again later w/o cdp
the machine will still be in cdp enabled mode. I fixed that up with proper
error handling. Please verify the changes carefuly.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ