[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAXuY3rLEt9nqOBSNaWjLMHNg6pDHdjtg7hFiYx-KCDhyfnkcg@mail.gmail.com>
Date: Thu, 17 Oct 2019 17:33:56 -0700
From: Iurii Zaikin <yzaikin@...gle.com>
To: Brendan Higgins <brendanhiggins@...gle.com>
Cc: shuah <shuah@...nel.org>, john.johansen@...onical.com,
jmorris@...ei.org, serge@...lyn.com, keescook@...omium.org,
alan.maguire@...cle.com, davidgow@...gle.com,
Luis Chamberlain <mcgrof@...nel.org>,
"Theodore Ts'o" <tytso@....edu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-security-module@...r.kernel.org,
KUnit Development <kunit-dev@...glegroups.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
Mike Salvatore <mike.salvatore@...onical.com>
Subject: Re: [PATCH linux-kselftest/test v1] apparmor: add AppArmor KUnit
tests for policy unpack
On Thu, Oct 17, 2019 at 5:19 PM Brendan Higgins
<brendanhiggins@...gle.com> wrote:
> +config SECURITY_APPARMOR_TEST
> + bool "Build KUnit tests for policy_unpack.c"
> + default n
> + depends on KUNIT && SECURITY_APPARMOR
> + help
>
select SECURITY_APPARMOR ?
> + KUNIT_EXPECT_EQ(test, size, TEST_BLOB_DATA_SIZE);
> + KUNIT_EXPECT_TRUE(test,
> + memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE) == 0);
I think this must be KUNIT_ASSERT_EQ(test, size, TEST_BLOB_DATA_SIZE);,
otherwise there could be a buffer overflow in memcmp. All tests that
follow such pattern
are suspect. Also, not sure about your stylistic preference for
KUNIT_EXPECT_TRUE(test,
memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE) == 0);
vs
KUNIT_EXPECT_EQ(test,
0,
memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE));
Powered by blists - more mailing lists