Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp216477lqt; Mon, 18 Mar 2024 06:10:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXi020pbM5ekPHY9d3I3/8BX4/npW9rejmJ3M4vvYyqELqr4tTPm8Ph7Q5rAL9jHizxfTrth2zT/AW3ks3HIKomoC4kEk5XDeDwhzqnAg== X-Google-Smtp-Source: AGHT+IF/F9uojDRQxHyvUWNGrBt707CShw+bgNaXYcqNNGhKWOhR+TTDKb0PRwudrsEsVR/7T4bg X-Received: by 2002:a05:6a20:c505:b0:1a0:adbc:7a96 with SMTP id gm5-20020a056a20c50500b001a0adbc7a96mr7499262pzb.36.1710767421688; Mon, 18 Mar 2024 06:10:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710767421; cv=pass; d=google.com; s=arc-20160816; b=Eojio/wdNCWOA3jn+lZKTVytjLmMU5t14+Gr5vv9o5h8sOltdRPyn6212w7w105HcT eAuH1YOvYPU4vZDJOzRdE5+MiLgn+6bGP2MFfzBGCIuIDPPwff/2dE/1RJXF/VS5w1jz mukYtyXEZpQCFNqhIjlL23DLVT55cus6V9A0BHWwPP+7VoKOPgmM69AYN5wXpdSdrU3i Ee1oeHMNuMQjYwsiCmvjC1eFsQdEATnMNf+gooVu1NOmcZxrVpJGTfsKzKFWH9DEBZiO S/6stjc8HlNWUnRbTGvYfSxoKHmL1hjfyPBS+7iGDVvTALbdkca9wYKvRhhkJm5A+ogI uRdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=6taV8JAUEtC4HnRx7IY+OYtv4kMrp/TsT5eNF60jDoA=; fh=DLgtpAyWxOhAqNuLRTW3Q89r2QcY33jV4El0hkIkzMk=; b=UHlLKJ/cNmLmklqhJryRLLAUPzkYT8iHCipTbxO2D/qLL/cFP64gI+VQFiEzY1GyPP V3dLIOllH9TznDVtl0YCI6Y8dUFwFzSVuriG9/GC77ZL/W6tJ6PBrtYi6TsllNbC3LJQ npmauiYBGCBZAufM/i5ooOl/9o9SFKr2s2WfmrFAO+4ot+HxyelcxOJ2JRYH1nzrIokH pGECYS9ygQxNOi5kQlaF+MfSiQgsrZkNKlEaybl0ndBDK7ko6StrlHIcAC6pN5TmI0za YU4foHgCbyyMKKBNSqTNVp6LPGz1WRj4XxY5z+ERdv0tZ4LS1iqv1MU/tyb+6U0OzWvV upBA==; 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-106149-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106149-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k13-20020a635a4d000000b005c66b8a7329si8097345pgm.15.2024.03.18.06.10.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 06:10:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106149-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-106149-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106149-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A7C30B2204B for ; Mon, 18 Mar 2024 13:09:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B2163BBCB; Mon, 18 Mar 2024 13:09:22 +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 D17E93BBC5 for ; Mon, 18 Mar 2024 13:09:19 +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=1710767362; cv=none; b=eUAi1M5BgwCM2ne30EgZJNW1kdsMi2EhO4gH3/yaXMoVpjZ2K1FGl/CbNUOYChpO7Y8S07x06mNSaIJVoSBDdL5CIsGapFrMfDl5TRXMEYjNqMHHzXJzrjB8bsxyuGU5Ihsanfv19G+k8aMqiFs3jU3t96em8gz/wIM/XRLv+Tc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710767362; c=relaxed/simple; bh=zVKoSp9MJ5rj38NlbSUrwPP0dgLqjGy1AqRmOpBYZzU=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=LZsKvXpcDGVsp5rnJJCP7K/pV2XiP885/RA6wENztdvHMC47AlykDNP0gPzKHtRoxBTS/EpV481tjQIUK9xaX/ur1fA2DDfJrCWuj0xVlILp3tp56gY2NRjGqz2N2JEnTSGjyjqfR/RMdlsLDZgVOLmX+64s3degsT19slXN70U= 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.29]) by frasgout13.his.huawei.com (SkyGuard) with ESMTP id 4Tyvsv4yQqz9xHvc for ; Mon, 18 Mar 2024 20:53:23 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.27]) by mail.maildlp.com (Postfix) with ESMTP id 03501140124 for ; Mon, 18 Mar 2024 21:09:17 +0800 (CST) Received: from [10.81.220.121] (unknown [10.81.220.121]) by APP2 (Coremail) with SMTP id GxC2BwCHcyf1PPhlpmyFBA--.45229S2; Mon, 18 Mar 2024 14:09:16 +0100 (CET) Message-ID: <8d45f94c-bce1-4327-9573-cec254a4e9c3@huaweicloud.com> Date: Mon, 18 Mar 2024 14:09:07 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RESEND 1/1] um: oops on accessing a non-present page in the vmalloc area From: Petr Tesarik To: Richard Weinberger , Anton Ivanov , Johannes Berg , "open list:USER-MODE LINUX (UML)" , open list Cc: Roberto Sassu , =?UTF-8?B?UGV0ciBUZXNhxZnDrWs=?= References: <20240223140435.1240-1-petrtesarik@huaweicloud.com> <9284cda7-d7e3-4390-bf62-58092e97d1c8@huaweicloud.com> Content-Language: en-US In-Reply-To: <9284cda7-d7e3-4390-bf62-58092e97d1c8@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID:GxC2BwCHcyf1PPhlpmyFBA--.45229S2 X-Coremail-Antispam: 1UD129KBjvJXoW7ZF18Wr17tF1rGr17Cr4kZwb_yoW8AFWUpF s3Ga18tFZFgF12vanrXa4qvr4xKa9rt3W7CrsrA34Fvr1q9FyfArW5KwnrCw1j9rWrKa1f tFWYyr9rAws8Jw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyv14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJV WxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l42xK82IYc2Ij64vIr41l 4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI 8IcIk0rVW3JVWrJr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VU1a9aPUUUUU== X-CM-SenderInfo: hshw23xhvd2x3n6k3tpzhluzxrxghudrp/ On 3/12/2024 4:07 PM, Petr Tesarik wrote: > On 2/23/2024 3:04 PM, Petr Tesarik wrote: >> From: Petr Tesarik >> >> 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. > > Ping. Any comment on this fix? I don't think I have seen a reply from you. If you did comment, then your email has not reached me. Please, can you confirm you have seen my patch? Kind regards Petr T > Petr T > >> >> Signed-off-by: Petr Tesarik >> --- >> 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; >> } >