xfs: assure zeroed memory buffers for certain kmem allocations
authorBill O'Donnell <billodo@redhat.com>
Fri, 4 Oct 2019 23:38:44 +0000 (16:38 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sun, 6 Oct 2019 22:39:06 +0000 (15:39 -0700)
commit3219e8cf0dade9884d3c6cb432d433b4ca56875d
treeac636fd31c84fd346ec0c923783aafb71033a4c3
parentd5cc14d9f92833bd71219bf7fff180f097c3816d
xfs: assure zeroed memory buffers for certain kmem allocations

Guarantee zeroed memory buffers for cases where potential memory
leak to disk can occur. In these cases, kmem_alloc is used and
doesn't zero the buffer, opening the possibility of information
leakage to disk.

Use existing infrastucture (xfs_buf_allocate_memory) to obtain
the already zeroed buffer from kernel memory.

This solution avoids the performance issue that would occur if a
wholesale change to replace kmem_alloc with kmem_zalloc was done.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
[darrick: fix bitwise complaint about kmflag_mask]
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_buf.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log_recover.c