Re: [PATCH] ipc: add set_ownership() and permissions() callbacks for posix mqueue sysctl

From: CGEL
Date: Tue Aug 03 2021 - 06:31:09 EST


O Thu, Jul 29, 2021 at 04:53:48PM +0200, Christian Brauner wrote:
>
> Yeah, we did that work specifically for the network namespace but knew
> there were quite a few places that would need fix up. This makes sense
> to me.
>
> Please add tests for this patch though. Also make sure to run them in a
> tight loop on a kernel with memory and log debugging enabled.
For now i have rebuilt the kernel turning on the config items you
suggested and some other kernel hacking and locking debug configs.
I tested this by a shell script concurrently writing the mqueue sysctl
files and checking the value. Do you mean that i should add some test code in this patch?
Can you give some examples for this tests code?

> The whole sysctl retire stuff can't be called from rcu contexts and that's easy to
> miss.
for this patch, retire_mq_sysctls() is called by free_ipc_ns(), and free_ipc_ns() is
triggered by schedule_work(&free_ipc_work) in kthread context.
Can you give some comments on the chance this code running on rcu
context?

> So turn on at least sm like:
>
> CONFIG_HAVE_ARCH_KASAN=y
> CONFIG_HAVE_ARCH_KASAN_VMALLOC=y
> CONFIG_CC_HAS_KASAN_GENERIC=y
> CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
> CONFIG_KASAN=y
> CONFIG_KASAN_GENERIC=y
> # CONFIG_KASAN_OUTLINE is not set
> CONFIG_KASAN_INLINE=y
> CONFIG_KASAN_STACK=1
> CONFIG_KASAN_VMALLOC=y
> # CONFIG_KASAN_MODULE_TEST is not set
> CONFIG_HAVE_ARCH_KFENCE=y
> CONFIG_KFENCE=y
> CONFIG_KFENCE_STATIC_KEYS=y
> CONFIG_KFENCE_SAMPLE_INTERVAL=100
> CONFIG_KFENCE_NUM_OBJECTS=255
> CONFIG_KFENCE_STRESS_TEST_FAULTS=0
> CONFIG_LOCKDEP_SUPPORT=y
> CONFIG_LOCKDEP=y