-
Notifications
You must be signed in to change notification settings - Fork 0
block: zero non-PI portion of auto integrity buffer #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linus-master_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: 623fb99 |
|
Upstream branch: 623fb99 |
7357b8f to
5b8f38c
Compare
|
Upstream branch: 623fb99 |
5b8f38c to
629c41e
Compare
f962a4d to
06634b5
Compare
The auto-generated integrity buffer for writes needs to be fully
initialized before being passed to the underlying block device,
otherwise the uninitialized memory can be read back by userspace or
anyone with physical access to the storage device. If protection
information is generated, that portion of the integrity buffer is
already initialized. The integrity data is also zeroed if PI generation
is disabled via sysfs or the PI tuple size is 0. However, this misses
the case where PI is generated and the PI tuple size is nonzero, but the
metadata size is larger than the PI tuple. In this case, the remainder
("opaque") of the metadata is left uninitialized.
Generalize the BLK_INTEGRITY_CSUM_NONE check to cover any case when the
metadata is larger than just the PI tuple.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: c546d6f ("block: only zero non-PI metadata tuples in bio_integrity_prep")
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Since commit ec7f31b ("block: make bio auto-integrity deadlock safe"), the gfp_t gfp variable in bio_integrity_prep() is no longer passed to an allocation function. It's only used to compute the zero_buffer argument to bio_integrity_alloc_buf(). So change the variable to bool zero_buffer to simplify the code. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
bi_offload_capable() returns whether a block device's metadata size matches its PI tuple size. Use pi_tuple_size instead of switching on csum_type. This makes the code considerably simpler and less branchy. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Anuj Gupta <anuj20.g@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
|
Upstream branch: b543459 |
629c41e to
91d0936
Compare
Pull request for series with
subject: block: zero non-PI portion of auto integrity buffer
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1040053