* [PATCH v2] xfs: fix stack contents leakage in the v1 inumber ioctls
@ 2019-07-25 17:53 Darrick J. Wong
2019-07-25 18:16 ` Eric Sandeen
2019-07-26 6:37 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2019-07-25 17:53 UTC (permalink / raw)
To: linux-xfs; +Cc: Dan Carpenter, Eric Sandeen
Explicitly initialize the onstack structures to zero so we don't leak
kernel memory into userspace when converting the in-core inumbers
structure to the v1 inogrp ioctl structure. Add a comment about why we
have to use memset to ensure that the padding holes in the structures
are set to zero.
Fixes: 5f19c7fc6873351 ("xfs: introduce v5 inode group structure")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: add comments, use memset this time
---
fs/xfs/xfs_itable.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 30fe17d25518..39374c680c49 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -283,6 +283,7 @@ xfs_bulkstat_to_bstat(
struct xfs_bstat *bs1,
const struct xfs_bulkstat *bstat)
{
+ /* memset is needed here because of padding holes in the structure. */
memset(bs1, 0, sizeof(struct xfs_bstat));
bs1->bs_ino = bstat->bs_ino;
bs1->bs_mode = bstat->bs_mode;
@@ -399,6 +400,8 @@ xfs_inumbers_to_inogrp(
struct xfs_inogrp *ig1,
const struct xfs_inumbers *ig)
{
+ /* memset is needed here because of padding holes in the structure. */
+ memset(ig1, 0, sizeof(struct xfs_inogrp));
ig1->xi_startino = ig->xi_startino;
ig1->xi_alloccount = ig->xi_alloccount;
ig1->xi_allocmask = ig->xi_allocmask;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] xfs: fix stack contents leakage in the v1 inumber ioctls
2019-07-25 17:53 [PATCH v2] xfs: fix stack contents leakage in the v1 inumber ioctls Darrick J. Wong
@ 2019-07-25 18:16 ` Eric Sandeen
2019-07-26 6:37 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2019-07-25 18:16 UTC (permalink / raw)
To: Darrick J. Wong, linux-xfs; +Cc: Dan Carpenter, Eric Sandeen
On 7/25/19 12:53 PM, Darrick J. Wong wrote:
> Explicitly initialize the onstack structures to zero so we don't leak
> kernel memory into userspace when converting the in-core inumbers
> structure to the v1 inogrp ioctl structure. Add a comment about why we
> have to use memset to ensure that the padding holes in the structures
> are set to zero.
>
> Fixes: 5f19c7fc6873351 ("xfs: introduce v5 inode group structure")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
> v2: add comments, use memset this time
> ---
> fs/xfs/xfs_itable.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
> index 30fe17d25518..39374c680c49 100644
> --- a/fs/xfs/xfs_itable.c
> +++ b/fs/xfs/xfs_itable.c
> @@ -283,6 +283,7 @@ xfs_bulkstat_to_bstat(
> struct xfs_bstat *bs1,
> const struct xfs_bulkstat *bstat)
> {
> + /* memset is needed here because of padding holes in the structure. */
> memset(bs1, 0, sizeof(struct xfs_bstat));
> bs1->bs_ino = bstat->bs_ino;
> bs1->bs_mode = bstat->bs_mode;
> @@ -399,6 +400,8 @@ xfs_inumbers_to_inogrp(
> struct xfs_inogrp *ig1,
> const struct xfs_inumbers *ig)
> {
> + /* memset is needed here because of padding holes in the structure. */
> + memset(ig1, 0, sizeof(struct xfs_inogrp));
> ig1->xi_startino = ig->xi_startino;
> ig1->xi_alloccount = ig->xi_alloccount;
> ig1->xi_allocmask = ig->xi_allocmask;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] xfs: fix stack contents leakage in the v1 inumber ioctls
2019-07-25 17:53 [PATCH v2] xfs: fix stack contents leakage in the v1 inumber ioctls Darrick J. Wong
2019-07-25 18:16 ` Eric Sandeen
@ 2019-07-26 6:37 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2019-07-26 6:37 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs, Dan Carpenter, Eric Sandeen
On Thu, Jul 25, 2019 at 10:53:46AM -0700, Darrick J. Wong wrote:
> Explicitly initialize the onstack structures to zero so we don't leak
> kernel memory into userspace when converting the in-core inumbers
> structure to the v1 inogrp ioctl structure. Add a comment about why we
> have to use memset to ensure that the padding holes in the structures
> are set to zero.
>
> Fixes: 5f19c7fc6873351 ("xfs: introduce v5 inode group structure")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> v2: add comments, use memset this time
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-26 6:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 17:53 [PATCH v2] xfs: fix stack contents leakage in the v1 inumber ioctls Darrick J. Wong
2019-07-25 18:16 ` Eric Sandeen
2019-07-26 6:37 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.