From: shuah <shuah@kernel.org>
To: Kees Cook <keescook@chromium.org>, "Dmitry V. Levin" <ldv@altlinux.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
Will Drewry <wad@chromium.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>, shuah <shuah@kernel.org>
Subject: Re: [PATCH] selftests: do not macro-expand failed assertion expressions
Date: Mon, 10 Dec 2018 10:57:35 -0700 [thread overview]
Message-ID: <4907f73f-2a07-d6d2-fcb8-280f3066851a@kernel.org> (raw)
In-Reply-To: <CAGXu5jKLHbfgZLGqxwG8LRs=0hy+iJGYQd61Ad5LghrkDWV=4w@mail.gmail.com>
On 12/10/18 10:30 AM, Kees Cook wrote:
> On Sun, Dec 9, 2018 at 3:00 PM Dmitry V. Levin <ldv@altlinux.org> wrote:
>>
>> I've stumbled over the current macro-expand behaviour of the test
>> harness:
>>
>> $ gcc -Wall -xc - <<'__EOF__'
>> TEST(macro) {
>> int status = 0;
>> ASSERT_TRUE(WIFSIGNALED(status));
>> }
>> TEST_HARNESS_MAIN
>> __EOF__
>> $ ./a.out
>> [==========] Running 1 tests from 1 test cases.
>> [ RUN ] global.macro
>> <stdin>:4:global.macro:Expected 0 (0) != (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) (0)
>> global.macro: Test terminated by assertion
>> [ FAIL ] global.macro
>> [==========] 0 / 1 tests passed.
>> [ FAILED ]
>>
>> With this change the output of the same test looks much more
>> comprehensible:
>>
>> [==========] Running 1 tests from 1 test cases.
>> [ RUN ] global.macro
>> <stdin>:4:global.macro:Expected 0 (0) != WIFSIGNALED(status) (0)
>> global.macro: Test terminated by assertion
>> [ FAIL ] global.macro
>> [==========] 0 / 1 tests passed.
>> [ FAILED ]
>>
>> The issue is very similar to the bug fixed in glibc assert(3)
>> three years ago:
>> https://sourceware.org/bugzilla/show_bug.cgi?id=18604
>>
>> Cc: Shuah Khan <shuah@kernel.org>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: Andy Lutomirski <luto@amacapital.net>
>> Cc: Will Drewry <wad@chromium.org>
>> Cc: linux-kselftest@vger.kernel.org
>> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
>
> Yeah, good idea.
>
> Acked-by: Kees Cook <keescook@chromium.org>
>
Thanks. Applied to linux-kselftest next.
-- Shuah
prev parent reply other threads:[~2018-12-10 17:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-09 23:00 Dmitry V. Levin
2018-12-10 17:30 ` Kees Cook
2018-12-10 17:57 ` shuah [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=4907f73f-2a07-d6d2-fcb8-280f3066851a@kernel.org \
--to=shuah@kernel.org \
--cc=keescook@chromium.org \
--cc=ldv@altlinux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=wad@chromium.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®