Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp14378191ybl; Mon, 30 Dec 2019 09:02:57 -0800 (PST) X-Google-Smtp-Source: APXvYqw/SmVRQxP/nKGnARDcv9tC2YBZ6bnNHS++L/Pf1oy0v2htdpnmjPG8iQwxYqoqMGEFLSQf X-Received: by 2002:a05:6830:1689:: with SMTP id k9mr77904620otr.311.1577725374148; Mon, 30 Dec 2019 09:02:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577725374; cv=none; d=google.com; s=arc-20160816; b=HGWTLawLVnhPpXyZz6zdTeWDykleuLJfY4eviaR/VSSIx9OoDvcTuPZdqOyLzmQ18U 55dPlzOn+TRcO9aiWlqsBVodIhnjCftuEkSpAz3n7MTjWr8xkmQGWqJkl6vr7AWruR+Z ZxjjSZyAdzGIgpjvrrPMIHDyuWG4RkuKMoSy28OSCk9U06cOMhDc6bVtwe+KZN/bR60X T4qbMPC1lOHbM9XFzitDbUfFtPNqLxZ6a4ICVultdmd0kfrxjCyxS6NltI62mF7I/GPb SYod666sCAJye36E7j9DaVpb/2CrIVY0ySfl/xzVxFC+eAgw3C1Zcn/gwZNQYM418D5Z /cbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=J95QypqqJNuPndge7VHSimhpzIAmVqS8E4TJccxuK5Q=; b=Zoky5iz79V2HpV1EDAcXxrgvDn5GiBam7zxSSoYKKJ7O4WUXGn7rnp2/2zDpaIP777 smyMTj1DyR7Riq0Hp43ik0hbbOstKxn50Xk5OXvUpTeqTzQoHV9B78vVTZJtWGWTmCkR N7wVehC7BzlELDVzd0N+CAWidfk+MvmQi62VO3shS0a8SEIl5RZ0Mjb2KZYhemG1r3wL mR2k+koE77IK5zk0hD2+H5rG6M441aeIY9K6izCJyJthKVHom2JE0yo2aMcRipwQIPxE pRj3KWzjcatvNKwUAlD/PD11mePRLs1Gx5+CUCrV/j/9mI1PqR1t0w+DGI+9ZsjtpnCy kVQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si16787519otn.154.2019.12.30.09.02.32; Mon, 30 Dec 2019 09:02:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727275AbfL3RBt (ORCPT + 99 others); Mon, 30 Dec 2019 12:01:49 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:30494 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726675AbfL3RBt (ORCPT ); Mon, 30 Dec 2019 12:01:49 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBUH0B6u035515 for ; Mon, 30 Dec 2019 12:01:48 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2x6n48abdr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Dec 2019 12:01:47 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Dec 2019 17:01:46 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 30 Dec 2019 17:01:43 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xBUH1hB123986282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Dec 2019 17:01:43 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D566842041; Mon, 30 Dec 2019 17:01:42 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C11842052; Mon, 30 Dec 2019 17:01:42 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.184.68]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 30 Dec 2019 17:01:41 +0000 (GMT) Subject: Re: [IMA] 11b771ffff: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c From: Mimi Zohar To: kernel test robot , Lakshmi Ramasubramanian Cc: LKML , Mimi Zohar , linux-integrity@vger.kernel.org, lkp@lists.01.org Date: Mon, 30 Dec 2019 12:01:41 -0500 In-Reply-To: <20191227142335.GE2760@shao2-debian> References: <20191227142335.GE2760@shao2-debian> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19123017-0028-0000-0000-000003CCF55E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19123017-0029-0000-0000-000024905DBD Message-Id: <1577725301.5874.32.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-30_05:2019-12-27,2019-12-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 suspectscore=0 mlxscore=0 mlxlogscore=627 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912300154 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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] > [ 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] 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