* [PATCH] xfs: validate sb_logsunit is a multiple of the fs blocksize
@ 2017-10-24 0:28 Darrick J. Wong
2017-10-24 12:54 ` Brian Foster
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2017-10-24 0:28 UTC (permalink / raw)
To: xfs
Make sure the log stripe unit is sane before proceeding with mounting.
AFAICT this means that logsunit has to be 0, 1, or a multiple of the fs
block size. Found this by setting the LSB of logsunit in xfs/350 and
watching the system crash as soon as we try to write to the log.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_log.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index d729e00..da4dcab 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -659,6 +659,12 @@ xfs_log_mount(
XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks),
XFS_MAX_LOG_BYTES);
error = -EINVAL;
+ } else if (mp->m_sb.sb_logsunit > 1 &&
+ mp->m_sb.sb_logsunit % mp->m_sb.sb_blocksize) {
+ xfs_warn(mp,
+ "log stripe unit %u bytes must be a multiple of block size",
+ mp->m_sb.sb_logsunit);
+ error = -EINVAL;
}
if (error) {
if (xfs_sb_version_hascrc(&mp->m_sb)) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: validate sb_logsunit is a multiple of the fs blocksize
2017-10-24 0:28 [PATCH] xfs: validate sb_logsunit is a multiple of the fs blocksize Darrick J. Wong
@ 2017-10-24 12:54 ` Brian Foster
2017-10-24 18:18 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Brian Foster @ 2017-10-24 12:54 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs
On Mon, Oct 23, 2017 at 05:28:44PM -0700, Darrick J. Wong wrote:
> Make sure the log stripe unit is sane before proceeding with mounting.
> AFAICT this means that logsunit has to be 0, 1, or a multiple of the fs
> block size. Found this by setting the LSB of logsunit in xfs/350 and
> watching the system crash as soon as we try to write to the log.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_log.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index d729e00..da4dcab 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -659,6 +659,12 @@ xfs_log_mount(
> XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks),
> XFS_MAX_LOG_BYTES);
> error = -EINVAL;
> + } else if (mp->m_sb.sb_logsunit > 1 &&
> + mp->m_sb.sb_logsunit % mp->m_sb.sb_blocksize) {
> + xfs_warn(mp,
> + "log stripe unit %u bytes must be a multiple of block size",
> + mp->m_sb.sb_logsunit);
> + error = -EINVAL;
Looks fine, but I notice that the error handling just below only fails
the mount on v5 filesystems. Otherwise we warn and carry on. I'm not
sure why that is.. but is this a crash vector on v4 filesystems as well?
Brian
> }
> if (error) {
> if (xfs_sb_version_hascrc(&mp->m_sb)) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: validate sb_logsunit is a multiple of the fs blocksize
2017-10-24 12:54 ` Brian Foster
@ 2017-10-24 18:18 ` Darrick J. Wong
0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2017-10-24 18:18 UTC (permalink / raw)
To: Brian Foster; +Cc: xfs
On Tue, Oct 24, 2017 at 08:54:13AM -0400, Brian Foster wrote:
> On Mon, Oct 23, 2017 at 05:28:44PM -0700, Darrick J. Wong wrote:
> > Make sure the log stripe unit is sane before proceeding with mounting.
> > AFAICT this means that logsunit has to be 0, 1, or a multiple of the fs
> > block size. Found this by setting the LSB of logsunit in xfs/350 and
> > watching the system crash as soon as we try to write to the log.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > fs/xfs/xfs_log.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> > index d729e00..da4dcab 100644
> > --- a/fs/xfs/xfs_log.c
> > +++ b/fs/xfs/xfs_log.c
> > @@ -659,6 +659,12 @@ xfs_log_mount(
> > XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks),
> > XFS_MAX_LOG_BYTES);
> > error = -EINVAL;
> > + } else if (mp->m_sb.sb_logsunit > 1 &&
> > + mp->m_sb.sb_logsunit % mp->m_sb.sb_blocksize) {
> > + xfs_warn(mp,
> > + "log stripe unit %u bytes must be a multiple of block size",
> > + mp->m_sb.sb_logsunit);
> > + error = -EINVAL;
>
> Looks fine, but I notice that the error handling just below only fails
> the mount on v5 filesystems. Otherwise we warn and carry on. I'm not
> sure why that is.. but is this a crash vector on v4 filesystems as well?
It is a crash vector on v4 as well, so I'll be stricter about failing
the mount. I was trying to be cautious about this since there haven't
been general complaints about v4 filesystems, but ... eh. A crash is a
crash. :)
--D
>
> Brian
>
> > }
> > if (error) {
> > if (xfs_sb_version_hascrc(&mp->m_sb)) {
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-24 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 0:28 [PATCH] xfs: validate sb_logsunit is a multiple of the fs blocksize Darrick J. Wong
2017-10-24 12:54 ` Brian Foster
2017-10-24 18:18 ` Darrick J. Wong
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.