From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] sysctl/sysctl02: Add new regression test for overflow file-max
Date: Mon, 10 Jun 2019 17:06:46 +0800 [thread overview]
Message-ID: <5CFE1DA6.7010600@cn.fujitsu.com> (raw)
In-Reply-To: <20190606114134.GB13068@rei.lan>
Hi cryil
> Hi!
> +{
> + case $1 in
> + 1)sysctl_test_overflow ${check1};;
> + 2)sysctl_test_overflow ${check2};;
> + 3)sysctl_test_overflow ${check3};;
> + 4)sysctl_test_zero ${check4};;
> There is no point in having the numbers in check variables if we do case
> here, we can just pass it here.
OK. I will pass the number directly.
>> + esac
>> +}
>> +
>> +sysctl_test_overflow()
>> +{
>> + local old_value=$(cat "$dir""$name")
>> +
>> + sysctl -w "fs.file-max"=$1>/dev/null 2>&1
>> +
>> + local test_value=$(cat "$dir""$name")
>> +
>> + echo ${test_value} |grep -q ${old_value}
>> + if [ $? -eq 0 ]; then
>> + tst_res TPASS "file-max overflow, reject it and keep old value."
>> + else
>> + tst_res TFAIL "file-max overflow and set it to ${test_value}."
>> + fi
>> + cleanup
>> +}
>> +
>> +sysctl_test_zero()
>> +{
>> + sysctl -w "fs.file-max"=$1>/dev/null 2>&1
>> + tst_res TINFO "if it doesn't report TPASS after 60s sleep, system crashes"
>> + sleep 60
> What happens on the buggy kernel here?
>
> Does it crash reliably?
>
> It looks to me that reproducing this bug without KASAN enabled kernel
> would be really hard or even impossible, therefore the sleep here does
> not matter at all.
Yes. It crashes always on my machine but not having crash log (under /var/crash) without CONFIF_KASAN, and it hangs when sleep 120s with CONFIG_KASAN=y.
I think it crashes or hangs because the file-max is equal to 0 and it causes some system services or daemons can not run normally. Test it makes no sense.
This is not what I want to test. I only want to test whether trigger a KASAN error by setting 0.
I will send a v3 patch.
>> + tst_res TPASS "file-max is set 0 and doesn't crash"
>> +}
>> +
>> +cleanup()
>> +{
>> + sysctl -w "fs.""$name"=${orig_value}>/dev/null 2>&1
>> +}
>> +
>> +tst_run
>> --
>> 2.18.1
>>
>>
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2019-06-10 9:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 10:31 [LTP] [PATCH] sysctl/sysctl02: Add new regression test for overflow file-max Yang Xu
2019-06-06 10:41 ` Yang Xu
2019-06-06 10:45 ` [LTP] [PATCH v2] " Yang Xu
2019-06-06 11:41 ` Cyril Hrubis
2019-06-10 8:51 ` [LTP] [PATCH v3] " Yang Xu
2019-06-20 12:01 ` Petr Vorel
2019-06-21 1:26 ` Yang Xu
2019-07-03 14:42 ` Petr Vorel
2019-07-04 1:40 ` Yang Xu
2019-06-20 12:52 ` Petr Vorel
2019-06-10 9:06 ` Yang Xu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5CFE1DA6.7010600@cn.fujitsu.com \
--to=xuyang2018.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.