Message ID | 20240223140435.1240-1-petrtesarik@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-78443-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp604330dyb; Fri, 23 Feb 2024 06:06:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVrsb4ng3Ntlfsft8KRJ/EGjIp0WE5WAmB4SSfRnC5UGWTFts9f28bqx9nwnyvXJDC4dRHAxiAhNlyxYJBqXVSAQF9xVw== X-Google-Smtp-Source: AGHT+IHZNBXBU9dO5c3aIHh4IPOXtcXMKA4Eu2Sar4hZPaUgMQdDw3qWpdKr5xRGm7TH773i7t1O X-Received: by 2002:a05:6e02:1d8b:b0:363:b8fb:fcb7 with SMTP id h11-20020a056e021d8b00b00363b8fbfcb7mr2854386ila.16.1708697166841; Fri, 23 Feb 2024 06:06:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708697166; cv=pass; d=google.com; s=arc-20160816; b=ApDsi4eeZdCyIvPO4gFRcNdJMYj5veTC1u3WWWQ9DIJtTyuVBXb/az0ZO3cTQkQBdC YLp3clejzPW8ihU+W8EFcZPnNecn67kwaYRZHUU9lV2WKZJ4rumqLglSFCiQiveXfATP AX3saQ4tjBaJ7sqwLa2iNnp+ZForDlAf2EM72Vr9JWP41itZo/kgZOhu9ZgWLKJaIZnj /KAxaIzL/649BpwnsjgyMzYdvteM/BPMqoZMQiJjOS1F/2fb4N88bZDnct7r8nmwRGOb XK73Omt8PbJq2hOM1FfTiKKOvbxrFW82KrDZJgHIprZz/85jQyIdFau1kfLyUGPg97hz ubPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Jy1mji0huxlzAVzICNupOAFUqwB/9+kefsnRGGH0duA=; fh=l0xhDQi2YiCJnII4lRJgRHQPEBBPYBbMgTLdbnEOFPs=; b=HJx1PsehoSy2l9BOSypMeFrNTI+PmI5NZurW3nU+AMf4W1wJIlLZeBAErRiOJtJGZR dRv80zhNPnQgxvSDf2XLAC7jpNqwJInnYJ/R5Y0rHiajYWDCQR28g9OKhZJ6lRWQTVUP OV1ycPO4oN4xeq0tWVDjLbSBn8HfPbyZSRiCaM96dXzttHfZNxW6HfG1NMgDaowQat/t Clp3s4ci1SNRyerObnrwIpuiG/As8tJs4l/DSZ6F7pgzPx/ZReRggK/oENxHRi1d71kc L6DzmgCW39/CLiUO5myOyQiWoxULOoCAjb6T4cRrrTwadCr0u7mqhHRUYBapfLuUfAIe g5SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-78443-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78443-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y11-20020a056e021beb00b00363e695548asi571089ilv.151.2024.02.23.06.06.06 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:06:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78443-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-78443-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78443-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 99034284312 for <ouuuleilei@gmail.com>; Fri, 23 Feb 2024 14:06:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B85F8823AB; Fri, 23 Feb 2024 14:05:10 +0000 (UTC) Received: from frasgout13.his.huawei.com (frasgout13.his.huawei.com [14.137.139.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E513B81AB5 for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 14:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697109; cv=none; b=UZ3snf3di+BqtdJOyVS+O2vO9tC1uvOs7cqNvWuBrOy3R2+EkRwPMG6bWgkg4mHHs9fLGGzV+OMBcr24VmUO/S918yCYPnbIYdd/S4Q01EtDSlXH/ykBD41GNT5C3UzGOibXbylceeR95sK0Zx2wBjmLtHkzffcY0oaBO0yXaq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697109; c=relaxed/simple; bh=3pqc/pxRYqV2lohhwBLkMpVmkZWPaHZgO2ezrk/vsfA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mkM0JSd6XuF4wfLE/uiMYH2BbaIwXSi17TJp+otArZ8sgdhpnnkidot3uxt/CtKhAidFemgRdTPs59eZWEXoQbgNSqGNip8ooDTbF7nWjxGhm+TRDlHUGVLmIUHgs2GkopKUU7tnvPxOQdJ3Oeig1IJWnGzNYVN0RM2F8dOgCN0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=14.137.139.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.18.186.51]) by frasgout13.his.huawei.com (SkyGuard) with ESMTP id 4ThBFl05nFz9y3Cc for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 21:49:31 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.47]) by mail.maildlp.com (Postfix) with ESMTP id E866A14042B for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 22:04:55 +0800 (CST) Received: from huaweicloud.com (unknown [10.81.218.207]) by APP1 (Coremail) with SMTP id LxC2BwC3YBkApthlMxERAw--.25951S2; Fri, 23 Feb 2024 15:04:55 +0100 (CET) From: Petr Tesarik <petrtesarik@huaweicloud.com> To: Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, Johannes Berg <johannes@sipsolutions.net>, linux-um@lists.infradead.org (open list:USER-MODE LINUX (UML)), linux-kernel@vger.kernel.org (open list) Cc: Roberto Sassu <roberto.sassu@huaweicloud.com>, Petr Tesarik <petr.tesarik1@huawei-partners.com> Subject: [PATCH RESEND 1/1] um: oops on accessing a non-present page in the vmalloc area Date: Fri, 23 Feb 2024 15:04:35 +0100 Message-Id: <20240223140435.1240-1-petrtesarik@huaweicloud.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: LxC2BwC3YBkApthlMxERAw--.25951S2 X-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k3tpzhluzxrxghudrp/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791698840166025001 X-GMAIL-MSGID: 1791698840166025001 |
Series |
[RESEND,1/1] um: oops on accessing a non-present page in the vmalloc area
|
|
Commit Message
Petr Tesarik
Feb. 23, 2024, 2:04 p.m. UTC
From: Petr Tesarik <petr.tesarik1@huawei-partners.com> If a segmentation fault is caused by accessing an address in the vmalloc area, check that the target page is present. Currently, if the kernel hits a guard page in the vmalloc area, UML blindly assumes that the fault is caused by a stale mapping and will be fixed by flush_tlb_kernel_vm(). Unsurprisingly, if the fault is caused by accessing a guard page, no mapping is created, and when the faulting instruction is restarted, it will cause exactly the same fault again, effectively creating an infinite loop. Signed-off-by: Petr Tesarik <petr.tesarik1@huawei-partners.com> --- arch/um/kernel/trap.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 6d8ae86ae978..d5b85f1bfe33 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c @@ -206,11 +206,15 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, int err; int is_write = FAULT_WRITE(fi); unsigned long address = FAULT_ADDRESS(fi); + pte_t *pte; if (!is_user && regs) current->thread.segv_regs = container_of(regs, struct pt_regs, regs); if (!is_user && (address >= start_vm) && (address < end_vm)) { + pte = virt_to_pte(&init_mm, address); + if (!pte_present(*pte)) + page_fault_oops(regs, address, ip); flush_tlb_kernel_vm(); goto out; }