#! /bin/bash
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2019 Oracle, Inc.  All Rights Reserved.
#
# FS QA Test No. 529
#
# Regression test for a bug where XFS corrupts memory if the listxattr buffer
# is a particularly well crafted size on a filesystem that supports posix acls.
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
tmp=/tmp/$$
status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_cleanup()
{
	cd /
	rm -f $tmp.*
}

# get standard environment, filters and checks
. ./common/rc
. ./common/attr

# real QA test starts here
_supported_fs generic
_supported_os Linux
_require_acls
_require_scratch
_require_test_program "t_attr_corruption"

rm -f $seqres.full
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount

$here/src/t_attr_corruption $SCRATCH_MNT

status=0
exit
