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: <be483586-fa15-4426-ab16-7d250a6cf653@intel.com>
Date: Mon, 30 Jun 2025 18:33:50 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: "Moger, Babu" <bmoger@....com>, Babu Moger <babu.moger@....com>,
	<corbet@....net>, <tony.luck@...el.com>, <Dave.Martin@....com>,
	<james.morse@....com>, <tglx@...utronix.de>, <mingo@...hat.com>,
	<bp@...en8.de>, <dave.hansen@...ux.intel.com>
CC: <x86@...nel.org>, <hpa@...or.com>, <akpm@...ux-foundation.org>,
	<rostedt@...dmis.org>, <paulmck@...nel.org>, <thuth@...hat.com>,
	<ardb@...nel.org>, <gregkh@...uxfoundation.org>, <seanjc@...gle.com>,
	<thomas.lendacky@....com>, <pawan.kumar.gupta@...ux.intel.com>,
	<manali.shukla@....com>, <perry.yuan@....com>, <kai.huang@...el.com>,
	<peterz@...radead.org>, <xiaoyao.li@...el.com>, <kan.liang@...ux.intel.com>,
	<mario.limonciello@....com>, <xin3.li@...el.com>, <gautham.shenoy@....com>,
	<xin@...or.com>, <chang.seok.bae@...el.com>, <fenghuay@...dia.com>,
	<peternewman@...gle.com>, <maciej.wieczor-retman@...el.com>,
	<eranian@...gle.com>, <linux-doc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v14 25/32] fs/resctrl: Provide interface to update the
 event configurations

Hi Babu,

On 6/30/25 5:43 PM, Moger, Babu wrote:
> On 6/25/2025 6:21 PM, Reinette Chatre wrote:
>> On 6/13/25 2:05 PM, Babu Moger wrote:

...

>>> +     * the assignment
>>> +     */
>>> +    list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
>>> +        rdtgroup_assign_cntr(r, prgrp, mevt);
>>> +
>>> +        list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
>>> +            rdtgroup_assign_cntr(r, crgrp, mevt);
>>> +    }
>>> +}
>>> +
>>> +static int resctrl_process_configs(char *tok, u32 *val)
>>> +{
>>> +    char *evt_str;
>>> +    u32 temp_val;
>>> +    bool found;
>>> +    int i;
>>> +
>>> +next_config:
>>> +    if (!tok || tok[0] == '\0')
>>> +        return 0;
>>> +
>>> +    /* Start processing the strings for each memory transaction type */
>>> +    evt_str = strim(strsep(&tok, ","));
>>> +    found = false;
>>> +    for (i = 0; i < NUM_MBM_EVT_VALUES; i++) {
>>> +        if (!strcmp(mbm_config_values[i].name, evt_str)) {
>>> +            temp_val = mbm_config_values[i].val;
>>> +            found = true;
>>> +            break;
>>> +        }
>>> +    }
>>> +
>>> +    if (!found) {
>>> +        rdt_last_cmd_printf("Invalid memory transaction type %s\n", evt_str);
>>> +        return -EINVAL;
>>> +    }
>>> +
>>> +    *val |= temp_val;
>>
>> This still returns a partially initialized value on failure. Please only set
>> provided parameter on success.
> 
> Yes. Changed it.
> 
>  if (!tok || tok[0] == '\0') {
>                *val = temp_val;
>                return 0;
>  }

You may just not have included this in your snippet, but please ensure temp_val is always
initialized. Just this snippet on top of original patch risks using uninitialized variable.

>>> +
>>> +    goto next_config;
>>> +}
>>> +
>>> +static ssize_t event_filter_write(struct kernfs_open_file *of, char *buf,
>>> +                  size_t nbytes, loff_t off)
>>> +{
>>> +    struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
>>> +    struct mon_evt *mevt = rdt_kn_parent_priv(of->kn);
>>
>> With mon_evt::rid available it should not be necessary to hardcode the resource?
> 
> changed it
> 
>  r = resctrl_arch_get_resource(mevt->rid);
> 
>> Do any of these new functions need a struct rdt_resource parameter in addition
>> to struct mon_evt?
> 
> We need to make a call resctrl_arch_mbm_cntr_assign_enabled(r)) to proceed. So we need  struct rdt_resource.

Understood, but since struct rdt_resource can be determined from mon_evt::rid
it is not obvious to me that providing both is always needed by all these functions.

Reinette


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ