Re: [PATCH 1/4] mtd: spi-nor: micron-st: add advanced protection and security features

Michael Walle
2021-11-08T15:44:00Z

Hi,

Am 2021-10-27 12:33, schrieb shiva.linuxworks@gmail.com:
> From: Shivamurthy Shastri <sshivamurthy@micron.com>
>
> Micron SPI NOR flashes are enabled with advanced sector protection
> features, using volatile lock bits, non-volatile lock bits, global
> freeze bits and password.
>
> Advanced sector protection and security features offers additional
> levels of protection against accidentally corrupting code and data
> stored, and it also prevents malicious attacks that could intentionally
> modify or corrupt the code or data stored.
>
> Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
> ---
..

> +static const struct spi_nor_sec_ops authenta_ops = {
> + .secure_read = authenta_secure_read,
> + .secure_write = authenta_secure_write,
> + .read_vlock_bits = authenta_read_vlock_bits,
> + .write_vlock_bits = authenta_write_vlock_bits,
> + .read_nvlock_bits = authenta_read_nvlock_bits,
> + .write_nvlock_bits = authenta_write_nvlock_bits,
> + .erase_nvlock_bits = authenta_erase_nvlock_bits,
> + .read_global_freeze_bits = authenta_read_global_freeze_bits,
> + .write_global_freeze_bits = authenta_write_global_freeze_bits,
> + .read_password = authenta_read_password,

Could you please explain what secure read and write and all the
other ops actually are? Why is there no write password?

They all seem to be used together with advanced sector protection.
But you're just exporting all these ops to userspace. We already
have lock and unlock ioctls in place. I'd expect that this
sector protection will make use of these. Just exporting all the
commands to userspace is not the way to go.

-michael