<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/virt/nitro_enclaves, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/virt/nitro_enclaves?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/virt/nitro_enclaves?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-09-01T19:00:48Z</updated>
<entry>
<title>kunit: fix Kconfig for build-in tests USB4 and Nitro Enclaves</title>
<updated>2022-09-01T19:00:48Z</updated>
<author>
<name>Nico Pache</name>
<email>npache@redhat.com</email>
</author>
<published>2022-08-10T23:40:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=793f55b2971e3a95d77ad08e9da2a3dc6c946cd7'/>
<id>urn:sha1:793f55b2971e3a95d77ad08e9da2a3dc6c946cd7</id>
<content type='text'>
Both the USB4 and Nitro Enclaves KUNIT tests are now able to be compiled
if KUNIT is compiled as a module. This leads to issues if KUNIT is being
packaged separately from the core kernel and when KUNIT is run baremetal
without the required driver compiled into the kernel.

Fixes: 635dcd16844b ("thunderbolt: test: Use kunit_test_suite() macro")
Fixes: fe5be808fa6c ("nitro_enclaves: test: Use kunit_test_suite() macro")
Signed-off-by: Nico Pache &lt;npache@redhat.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Acked-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: test: Use kunit_test_suite() macro</title>
<updated>2022-07-11T23:13:27Z</updated>
<author>
<name>David Gow</name>
<email>davidgow@google.com</email>
</author>
<published>2022-07-09T03:20:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fe5be808fa6c8df5cf939ec622514f970573bc88'/>
<id>urn:sha1:fe5be808fa6c8df5cf939ec622514f970573bc88</id>
<content type='text'>
The kunit_test_suite() macro previously conflicted with module_init,
making it unsuitable for use in the nitro_enclaves test. Now that it's
fixed, we can use it instead of a custom call into internal KUnit
functions to run the test.

As a side-effect, this means that the test results are properly included
with other suites when built-in. To celebrate, enable the test by
default when KUNIT_ALL_TESTS is set (and NITRO_ENCLAVES enabled).

The nitro_enclave tests can now be run via kunit_tool with:
	./tools/testing/kunit/kunit.py run --arch=x86_64 \
	--kconfig_add CONFIG_PCI=y --kconfig_add CONFIG_SMP=y \
	--kconfig_add CONFIG_HOTPLUG_CPU=y \
	--kconfig_add CONFIG_VIRT_DRIVERS=y \
	--kconfig_add CONFIG_NITRO_ENCLAVES=y \
	'ne_misc_dev_test'

(This is a pretty long command, so it may be worth adding a .kunitconfig
file at some point, instead.)

Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Acked-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Signed-off-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge 5.16-rc8 into char-misc-next</title>
<updated>2022-01-03T12:44:38Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2022-01-03T12:44:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=824adf37ee9ddf3ecba1bc245507bc5953dda268'/>
<id>urn:sha1:824adf37ee9ddf3ecba1bc245507bc5953dda268</id>
<content type='text'>
We need the fixes in here as well for testing.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Use get_user_pages_unlocked() call to handle mmap assert</title>
<updated>2021-12-21T10:08:19Z</updated>
<author>
<name>Andra Paraschiv</name>
<email>andraprs@amazon.com</email>
</author>
<published>2021-12-20T19:58:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3a0152b219523227c2a62a0a122cf99608287176'/>
<id>urn:sha1:3a0152b219523227c2a62a0a122cf99608287176</id>
<content type='text'>
After commit 5b78ed24e8ec ("mm/pagemap: add mmap_assert_locked()
annotations to find_vma*()"), the call to get_user_pages() will trigger
the mmap assert.

static inline void mmap_assert_locked(struct mm_struct *mm)
{
	lockdep_assert_held(&amp;mm-&gt;mmap_lock);
	VM_BUG_ON_MM(!rwsem_is_locked(&amp;mm-&gt;mmap_lock), mm);
}

[   62.521410] kernel BUG at include/linux/mmap_lock.h:156!
...........................................................
[   62.538938] RIP: 0010:find_vma+0x32/0x80
...........................................................
[   62.605889] Call Trace:
[   62.608502]  &lt;TASK&gt;
[   62.610956]  ? lock_timer_base+0x61/0x80
[   62.614106]  find_extend_vma+0x19/0x80
[   62.617195]  __get_user_pages+0x9b/0x6a0
[   62.620356]  __gup_longterm_locked+0x42d/0x450
[   62.623721]  ? finish_wait+0x41/0x80
[   62.626748]  ? __kmalloc+0x178/0x2f0
[   62.629768]  ne_set_user_memory_region_ioctl.isra.0+0x225/0x6a0 [nitro_enclaves]
[   62.635776]  ne_enclave_ioctl+0x1cf/0x6d7 [nitro_enclaves]
[   62.639541]  __x64_sys_ioctl+0x82/0xb0
[   62.642620]  do_syscall_64+0x3b/0x90
[   62.645642]  entry_SYSCALL_64_after_hwframe+0x44/0xae

Use get_user_pages_unlocked() when setting the enclave memory regions.
That's a similar pattern as mmap_read_lock() used together with
get_user_pages().

Fixes: 5b78ed24e8ec ("mm/pagemap: add mmap_assert_locked() annotations to find_vma*()")
Cc: stable@vger.kernel.org
Signed-off-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Link: https://lore.kernel.org/r/20211220195856.6549-1-andraprs@amazon.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Add KUnit tests for contiguous physical memory regions merging</title>
<updated>2021-11-17T15:11:09Z</updated>
<author>
<name>Longpeng</name>
<email>longpeng2@huawei.com</email>
</author>
<published>2021-11-07T14:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=fbf3443f77503f68f244cd7afa050c19ac78511c'/>
<id>urn:sha1:fbf3443f77503f68f244cd7afa050c19ac78511c</id>
<content type='text'>
Add KUnit tests for the contiguous physical memory regions merging
functionality from the Nitro Enclaves misc device logic.

We can build the test binary with the following configuration:
  CONFIG_KUNIT=y
  CONFIG_NITRO_ENCLAVES=m
  CONFIG_NITRO_ENCLAVES_MISC_DEV_TEST=y
and install the nitro_enclaves module to run the testcases.

We'll see the following message using dmesg if everything goes well:

[...]     # Subtest: ne_misc_dev_test
[...]     1..1
[...] (NULL device *): Physical mem region address is not 2 MiB aligned
[...] (NULL device *): Physical mem region size is not multiple of 2 MiB
[...] (NULL device *): Physical mem region address is not 2 MiB aligned
[...]     ok 1 - ne_misc_dev_test_merge_phys_contig_memory_regions
[...] ok 1 - ne_misc_dev_test

Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Signed-off-by: Longpeng &lt;longpeng2@huawei.com&gt;
Link: https://lore.kernel.org/r/20211107140918.2106-5-longpeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Add KUnit tests setup for the misc device functionality</title>
<updated>2021-11-17T15:11:09Z</updated>
<author>
<name>Longpeng</name>
<email>longpeng2@huawei.com</email>
</author>
<published>2021-11-07T14:09:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=07503b3c1e13fdeb66d4531c5dcba335eed9602a'/>
<id>urn:sha1:07503b3c1e13fdeb66d4531c5dcba335eed9602a</id>
<content type='text'>
Add the initial setup for the KUnit tests that will target the Nitro
Enclaves misc device functionality.

Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Signed-off-by: Longpeng &lt;longpeng2@huawei.com&gt;
Link: https://lore.kernel.org/r/20211107140918.2106-4-longpeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Sanity check physical memory regions during merging</title>
<updated>2021-11-17T15:11:09Z</updated>
<author>
<name>Longpeng</name>
<email>longpeng2@huawei.com</email>
</author>
<published>2021-11-07T14:09:15Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=090ce7831d340e8be92e5f2a90617cca6e92156e'/>
<id>urn:sha1:090ce7831d340e8be92e5f2a90617cca6e92156e</id>
<content type='text'>
Sanity check the physical memory regions during the merge of contiguous
regions. Thus we can test the physical memory regions setup logic
individually, including the error cases coming from the sanity checks.

Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Signed-off-by: Longpeng &lt;longpeng2@huawei.com&gt;
Link: https://lore.kernel.org/r/20211107140918.2106-3-longpeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Merge contiguous physical memory regions</title>
<updated>2021-11-17T15:11:09Z</updated>
<author>
<name>Longpeng</name>
<email>longpeng2@huawei.com</email>
</author>
<published>2021-11-07T14:09:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f6bdc0aafe88cf4c727e7bb00da1f480ecd80bee'/>
<id>urn:sha1:f6bdc0aafe88cf4c727e7bb00da1f480ecd80bee</id>
<content type='text'>
There can be cases when there are more memory regions that need to be
set for an enclave than the maximum supported number of memory regions
per enclave. One example can be when the memory regions are backed by 2
MiB hugepages (the minimum supported hugepage size).

Let's merge the adjacent regions if they are physically contiguous. This
way the final number of memory regions is less than before merging and
could potentially avoid reaching maximum.

Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Signed-off-by: Longpeng &lt;longpeng2@huawei.com&gt;
Link: https://lore.kernel.org/r/20211107140918.2106-2-longpeng2@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Remove redundant 'flush_workqueue()' calls</title>
<updated>2021-11-17T15:10:26Z</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2021-11-12T17:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=dc74e8cf2324ad61b050a55ec0ffa9db6f4fce33'/>
<id>urn:sha1:dc74e8cf2324ad61b050a55ec0ffa9db6f4fce33</id>
<content type='text'>
'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

This was generated with coccinelle:

@@
expression E;
@@
- 	flush_workqueue(E);
	destroy_workqueue(E);

Reviewed-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Link: https://lore.kernel.org/r/d57f5c7e362837a8dfcde0d726a76b56f114e619.1636736947.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>nitro_enclaves: Add fixes for checkpatch match open parenthesis reports</title>
<updated>2021-09-14T09:11:20Z</updated>
<author>
<name>Andra Paraschiv</name>
<email>andraprs@amazon.com</email>
</author>
<published>2021-08-27T15:49:28Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=02bba596de19c0b951b2843ebcd7a9da6e0938d4'/>
<id>urn:sha1:02bba596de19c0b951b2843ebcd7a9da6e0938d4</id>
<content type='text'>
Update the codebase formatting to fix the reports from the checkpatch
script, to match the open parenthesis.

Reviewed-by: George-Aurelian Popescu &lt;popegeo@amazon.com&gt;
Signed-off-by: Andra Paraschiv &lt;andraprs@amazon.com&gt;
Link: https://lore.kernel.org/r/20210827154930.40608-6-andraprs@amazon.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
