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:   Thu, 13 Jul 2023 19:48:11 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc:     hdegoede@...hat.com, markgross@...nel.org,
        ilpo.jarvinen@...ux.intel.com, platform-driver-x86@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/3] platform/x86/intel/tpmi: Add debugfs interface

On Wed, Jul 12, 2023 at 03:59:49PM -0700, Srinivas Pandruvada wrote:
> Add debugfs interface for debugging TPMI configuration and register
> contents. This shows PFS (PM Feature structure) for each TPMI device.
> 
> For each feature, show full register contents and allow to modify
> register at an offset.
> 
> This debugfs interface is not present on locked down kernel with no
> DEVMEM access and without CAP_SYS_RAWIO permission.

...

> +	for (i = 0; i < tpmi_info->feature_count; ++i) {

As I explained in the discussion in previous version the preincrement is rising
unneeded attention when there is nothing special about it.

> +		pfs = &tpmi_info->tpmi_features[i];
> +		ret = tpmi_read_feature_status(tpmi_info, pfs->pfs_header.tpmi_id, &locked,
> +					       &disabled);
> +		if (ret) {
> +			locked = 'U';
> +			disabled = 'U';
> +		} else {
> +			disabled = disabled ? 'Y' : 'N';
> +			locked = locked ? 'Y' : 'N';
> +		}
> +		seq_printf(s, "0x%02x\t\t0x%02x\t\t0x%04x\t\t0x%04x\t\t0x%02x\t\t0x%08x\t%c\t%c\n",
> +			   pfs->pfs_header.tpmi_id, pfs->pfs_header.num_entries,
> +			   pfs->pfs_header.entry_size, pfs->pfs_header.cap_offset,
> +			   pfs->pfs_header.attribute, pfs->vsec_offset, locked, disabled);
> +	}

...

> +	for (count = 0; count < pfs->pfs_header.num_entries; ++count) {

Ditto.

> +		seq_printf(s, "TPMI Instance:%d offset:0x%x\n", count, off);
> +
> +		mem = ioremap(off, size);
> +		if (!mem) {
> +			ret = -ENOMEM;
> +			break;
> +		}
> +
> +		memcpy_fromio(buffer, mem, size);
> +
> +		seq_hex_dump(s, " ", DUMP_PREFIX_OFFSET, row_size, sizeof(u32), buffer, size,
> +			     false);
> +
> +		iounmap(mem);
> +
> +		off += size;
> +	}

...

> +	for (i = 0; i < tpmi_info->feature_count; ++i) {

Ditto.

> +		struct intel_tpmi_pm_feature *pfs;
> +		struct dentry *dir;
> +
> +		pfs = &tpmi_info->tpmi_features[i];
> +		snprintf(name, sizeof(name), "tpmi-id-%02x", pfs->pfs_header.tpmi_id);
> +		dir = debugfs_create_dir(name, tpmi_info->dbgfs_dir);
> +
> +		debugfs_create_file("mem_dump", 0444, dir, pfs, &tpmi_mem_dump_fops);
> +		debugfs_create_file("mem_write", 0644, dir, pfs, &mem_write_ops);
> +	}
> +}

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ