* Re: [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c
[not found] <20191227142335.GE2760@shao2-debian>
@ 2019-12-30 17:01 ` Mimi Zohar
2019-12-30 18:37 ` Lakshmi Ramasubramanian
2019-12-30 21:14 ` Lakshmi Ramasubramanian
1 sibling, 1 reply; 5+ messages in thread
From: Mimi Zohar @ 2019-12-30 17:01 UTC (permalink / raw)
To: kernel test robot, Lakshmi Ramasubramanian
Cc: LKML, Mimi Zohar, linux-integrity, lkp
Hi Lakshmi,
On Fri, 2019-12-27 at 22:23 +0800, kernel test robot wrote:
> [ 333.455345] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:281
> [ 333.457243] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 12395, name: userfaultfd
> [ 333.458888] CPU: 1 PID: 12395 Comm: userfaultfd Not tainted 5.5.0-rc1-00011-g11b771ffff8fc #1
> [ 333.461096] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
> [ 333.463893] Call Trace:
> [ 333.465287] <IRQ>
> [ 333.466351] dump_stack+0x66/0x8b
> [ 333.467346] ___might_sleep+0x102/0x120
> [ 333.468385] mutex_lock+0x1c/0x40
> [ 333.469421] ima_process_queued_keys+0x24/0x110
> [ 333.470529] ? ima_process_queued_keys+0x110/0x110
> [ 333.471656] call_timer_fn+0x2d/0x140
> [ 333.472707] run_timer_softirq+0x46f/0x4b0
> [ 333.473752] ? enqueue_hrtimer+0x39/0xa0
> [ 333.474780] __do_softirq+0xe3/0x2f8
> [ 333.475768] irq_exit+0xd5/0xe0
> [ 333.476738] smp_apic_timer_interrupt+0x74/0x140
> [ 333.477834] apic_timer_interrupt+0xf/0x20
> [ 333.478858] </IRQ>
I think this is an instance where defining timer_expired as atomic and
then testing it using atomic_dec_and_test() would help. Either the
queued keys would be deleted in ima_timer_handler() or measured in
ima_process_queued_keys().
Mimi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c
2019-12-30 17:01 ` [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c Mimi Zohar
@ 2019-12-30 18:37 ` Lakshmi Ramasubramanian
0 siblings, 0 replies; 5+ messages in thread
From: Lakshmi Ramasubramanian @ 2019-12-30 18:37 UTC (permalink / raw)
To: Mimi Zohar, kernel test robot; +Cc: LKML, Mimi Zohar, linux-integrity, lkp
On 12/30/19 9:01 AM, Mimi Zohar wrote:
Hi Mimi,
> Hi Lakshmi,
>
> On Fri, 2019-12-27 at 22:23 +0800, kernel test robot wrote:
>> [ 333.455345] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:281
>> [ 333.457243] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 12395, name: userfaultfd
>> [ 333.458888] CPU: 1 PID: 12395 Comm: userfaultfd Not tainted 5.5.0-rc1-00011-g11b771ffff8fc #1
>> [ 333.461096] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
>> [ 333.463893] Call Trace:
>> [ 333.465287] <IRQ>
>> [ 333.466351] dump_stack+0x66/0x8b
>> [ 333.467346] ___might_sleep+0x102/0x120
>> [ 333.468385] mutex_lock+0x1c/0x40
>> [ 333.469421] ima_process_queued_keys+0x24/0x110
>> [ 333.470529] ? ima_process_queued_keys+0x110/0x110
>> [ 333.471656] call_timer_fn+0x2d/0x140
>> [ 333.472707] run_timer_softirq+0x46f/0x4b0
>> [ 333.473752] ? enqueue_hrtimer+0x39/0xa0
>> [ 333.474780] __do_softirq+0xe3/0x2f8
>> [ 333.475768] irq_exit+0xd5/0xe0
>> [ 333.476738] smp_apic_timer_interrupt+0x74/0x140
>> [ 333.477834] apic_timer_interrupt+0xf/0x20
>> [ 333.478858] </IRQ>
>
> I think this is an instance where defining timer_expired as atomic and
> then testing it using atomic_dec_and_test() would help. Either the
> queued keys would be deleted in ima_timer_handler() or measured in
> ima_process_queued_keys().
>
> Mimi
Would it be better to use a spinlock (instead of a mutex) to synchronize
access to the queued keys list? That would work for timer callback
function also.
Before submitting the patch for freeing the keys I had tested the case
where queued keys are freed in timer callback. But I did not hit the
above break.
I will follow the steps given by Rong and validate the fix.
thanks,
-lakshmi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c
[not found] <20191227142335.GE2760@shao2-debian>
2019-12-30 17:01 ` [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c Mimi Zohar
@ 2019-12-30 21:14 ` Lakshmi Ramasubramanian
2020-01-04 11:49 ` Chen, Rong A
1 sibling, 1 reply; 5+ messages in thread
From: Lakshmi Ramasubramanian @ 2019-12-30 21:14 UTC (permalink / raw)
To: kernel test robot; +Cc: Mimi Zohar, LKML, Mimi Zohar, linux-integrity, lkp
On 12/27/19 6:23 AM, kernel test robot wrote:
Hi Rong,
>
>
> To reproduce:
>
> # build kernel
> cd linux
> cp config-5.5.0-rc1-00011-g11b771ffff8fc .config
> make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage
>
> git clone https://github.com/intel/lkp-tests.git
> cd lkp-tests
> bin/lkp qemu -k <bzImage> job-script # job-script is attached in this email
>
>
>
> Thanks,
> Rong Chen
>
Thanks for reporting this issue.
I built the kernel with the config you'd provided.
When running lkp-tests using the command line given, I see the following
error and the test stops.
bin/lkp qemu -k ../linux-5.5/arch/x86/boot/bzImage job-script
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
-N -P
/root/.lkp/cache/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c
Failed to download
pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
Please let me know what I am missing.
Full output of the command is given below:
bin/lkp qemu -k ../linux-5.5/arch/x86/boot/bzImage job-script
result_root:
/root/.lkp//result/kernel_selftests/kselftests-03/vm-snb/debian-x86_64-2019-11-14.cgz/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/8
downloading initrds ...
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/osimage/debian/debian-x86_64-2019-11-14.cgz
-N -P /root/.lkp/cache/osimage/debian
408859 blocks
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/run-ipconfig_2018-04-03.cgz
-N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
1414 blocks
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/lkp_2019-08-05.cgz
-N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
1670 blocks
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/rsync-rootfs_2018-04-03.cgz
-N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
8268 blocks
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/kernel_selftests_2019-12-25.cgz
-N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
932372 blocks
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/osimage/pkg/debian-x86_64-2018-04-03.cgz/kernel_selftests-x86_64-0dcf36db-1_2019-12-25.cgz
-N -P /root/.lkp/cache/osimage/pkg/debian-x86_64-2018-04-03.cgz
30125 blocks
/usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
https://download.01.org/0day-ci/lkp-qemu/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
-N -P
/root/.lkp/cache/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c
Failed to download
pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c
2019-12-30 21:14 ` Lakshmi Ramasubramanian
@ 2020-01-04 11:49 ` Chen, Rong A
2020-01-04 18:46 ` Lakshmi Ramasubramanian
0 siblings, 1 reply; 5+ messages in thread
From: Chen, Rong A @ 2020-01-04 11:49 UTC (permalink / raw)
To: Lakshmi Ramasubramanian
Cc: Mimi Zohar, LKML, Mimi Zohar, linux-integrity, lkp
On 12/31/2019 5:14 AM, Lakshmi Ramasubramanian wrote:
> On 12/27/19 6:23 AM, kernel test robot wrote:
>
> Hi Rong,
>
>>
>>
>> To reproduce:
>>
>> # build kernel
>> cd linux
>> cp config-5.5.0-rc1-00011-g11b771ffff8fc .config
>> make HOSTCC=gcc-7 CC=gcc-7 ARCH=x86_64 olddefconfig prepare
>> modules_prepare bzImage
>>
>> git clone https://github.com/intel/lkp-tests.git
>> cd lkp-tests
>> bin/lkp qemu -k <bzImage> job-script # job-script is
>> attached in this email
>>
>>
>>
>> Thanks,
>> Rong Chen
>>
>
> Thanks for reporting this issue.
>
> I built the kernel with the config you'd provided.
>
> When running lkp-tests using the command line given, I see the
> following error and the test stops.
>
> bin/lkp qemu -k ../linux-5.5/arch/x86/boot/bzImage job-script
>
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
> -N -P
> /root/.lkp/cache/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c
>
> Failed to download
> pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
>
> Please let me know what I am missing.
>
> Full output of the command is given below:
>
> bin/lkp qemu -k ../linux-5.5/arch/x86/boot/bzImage job-script
>
> result_root:
> /root/.lkp//result/kernel_selftests/kselftests-03/vm-snb/debian-x86_64-2019-11-14.cgz/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/8
> downloading initrds ...
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/osimage/debian/debian-x86_64-2019-11-14.cgz
> -N -P /root/.lkp/cache/osimage/debian
> 408859 blocks
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/run-ipconfig_2018-04-03.cgz
> -N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
> 1414 blocks
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/lkp_2019-08-05.cgz
> -N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
> 1670 blocks
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/rsync-rootfs_2018-04-03.cgz
> -N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
> 8268 blocks
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/osimage/deps/debian-x86_64-2018-04-03.cgz/kernel_selftests_2019-12-25.cgz
> -N -P /root/.lkp/cache/osimage/deps/debian-x86_64-2018-04-03.cgz
> 932372 blocks
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/osimage/pkg/debian-x86_64-2018-04-03.cgz/kernel_selftests-x86_64-0dcf36db-1_2019-12-25.cgz
> -N -P /root/.lkp/cache/osimage/pkg/debian-x86_64-2018-04-03.cgz
> 30125 blocks
> /usr/bin/wget -q --timeout=1800 --tries=1 --local-encoding=UTF-8
> https://download.01.org/0day-ci/lkp-qemu/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
> -N -P
> /root/.lkp/cache/pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c
> Failed to download
> pkg/linux/x86_64-rhel-7.6/gcc-7/11b771ffff8fc0bfc176b829d986896a7d97a44c/linux-headers.cgz
>
>
Hi,
Sorry for the delay, we updated the lkp-tests code and uploaded the
missing cgz files for this case.
Best Regards,
Rong Chen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c
2020-01-04 11:49 ` Chen, Rong A
@ 2020-01-04 18:46 ` Lakshmi Ramasubramanian
0 siblings, 0 replies; 5+ messages in thread
From: Lakshmi Ramasubramanian @ 2020-01-04 18:46 UTC (permalink / raw)
To: Chen, Rong A; +Cc: Mimi Zohar, LKML, Mimi Zohar, linux-integrity, lkp
On 1/4/2020 3:49 AM, Chen, Rong A wrote:
Hi Rong,
>
> Hi,
>
> Sorry for the delay, we updated the lkp-tests code and uploaded the
> missing cgz files for this case.
>
> Best Regards,
> Rong Chen
Thanks - I was able to execute the test and validate the fix.
-lakshmi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-04 18:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20191227142335.GE2760@shao2-debian>
2019-12-30 17:01 ` [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c Mimi Zohar
2019-12-30 18:37 ` Lakshmi Ramasubramanian
2019-12-30 21:14 ` Lakshmi Ramasubramanian
2020-01-04 11:49 ` Chen, Rong A
2020-01-04 18:46 ` Lakshmi Ramasubramanian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).