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] [day] [month] [year] [list]
Message-ID: <75e7d242-268c-07a3-a4f9-7b8252769140@gmail.com>
Date:   Mon, 18 May 2020 11:00:46 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc:     Jens Axboe <axboe@...nel.dk>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        David Heidelberg <david@...t.cz>,
        Peter Geis <pgwipeout@...il.com>,
        Stephen Warren <swarren@...dotorg.org>,
        Nicolas Chauvet <kwizart@...il.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Billy Laws <blaws05@...il.com>,
        Nils Östlund <nils@...tan.com>,
        Christoph Hellwig <hch@...radead.org>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Davidlohr Bueso <dave@...olabs.net>,
        linux-tegra@...r.kernel.org, linux-block@...r.kernel.org,
        Andrey Danin <danindrey@...l.ru>,
        Gilles Grandou <gilles@...ndou.net>,
        Ryan Grachek <ryan@...ted.us>, linux-mmc@...r.kernel.org,
        linux-kernel@...r.kernel.org, Steve McIntyre <steve@...val.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        linux-efi <linux-efi@...r.kernel.org>
Subject: Re: [PATCH v5 6/6] soc/tegra: Expose Boot Configuration Table via
 sysfs

18.05.2020 10:45, Michał Mirosław пишет:
> On Sat, May 16, 2020 at 06:36:44PM +0300, Dmitry Osipenko wrote:
>> It's quite useful to have unencrypted BCT exposed to userspace for
>> debugging purposes, so let's expose it via sysfs.  The BCT data will be
>> present in '/sys/tegra/boot_config_table' binary file if BCT is available.
> [...]
>> +/*
>> + * spare_bct[] will be released once kernel is booted, hence not wasting
>> + * kernel space if BCT is missing. The tegra_bct can't be allocated during
>> + * of BCT setting up because it's too early for the slab allocator.
>> + */
>> +static u8 spare_bct[SZ_8K] __initdata;
>> +static u8 *tegra_bct;
>> +
>> +static ssize_t boot_config_table_read(struct file *filp,
>> +				      struct kobject *kobj,
>> +				      struct bin_attribute *bin_attr,
>> +				      char *buf, loff_t off, size_t count)
>> +{
>> +	memcpy(buf, tegra_bct + off, count);
>> +	return count;
>> +}
>> +static BIN_ATTR_RO(boot_config_table, 0);
>> +
>> +static int __init tegra_bootdata_bct_sysfs_init(void)
>> +{
>> +	if (!bin_attr_boot_config_table.size)
>> +		return 0;
>> +
>> +	tegra_bct = kmalloc(GFP_KERNEL, bin_attr_boot_config_table.size);
>> +	if (!tegra_bct)
>> +		return -ENOMEM;
>> +
>> +	memcpy(tegra_bct, spare_bct, bin_attr_boot_config_table.size);
>> +
>> +	return sysfs_create_bin_file(tegra_soc_kobj,
>> +				     &bin_attr_boot_config_table);
> 
> Should we consider freeing the table if sysfs registration fails?

This is a good suggestion, thank you :)

>> +}
>> +late_initcall(tegra_bootdata_bct_sysfs_init)
>> +
>> +void __init tegra_bootdata_bct_setup(void __iomem *bct_ptr, size_t bct_size)
>> +{
>> +	memcpy_fromio(spare_bct, bct_ptr, bct_size);
>> +	bin_attr_boot_config_table.size = bct_size;
> [...]
> 
> The size isn't checked anywhere. How the maximum is obtained? At least
> a comment would be good if the 8k limit is guaranteed by other means.

Yes, I can add a clarifying comment about the 8K. It also should be
possible to create a union of T20/T30 BCT structs and then use use
sizeof(bct_union). I'll consider this change for the next version, thank
you for the suggestion.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ