From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70559C433F5 for ; Wed, 1 Dec 2021 08:45:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE3D76B0073; Wed, 1 Dec 2021 03:44:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D94BB6B0074; Wed, 1 Dec 2021 03:44:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5BD16B0075; Wed, 1 Dec 2021 03:44:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id B7CB96B0073 for ; Wed, 1 Dec 2021 03:44:57 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7822D894D8 for ; Wed, 1 Dec 2021 08:44:47 +0000 (UTC) X-FDA: 78868589814.07.FEEEC15 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by imf11.hostedemail.com (Postfix) with ESMTP id 26052F0000A1 for ; Wed, 1 Dec 2021 08:44:47 +0000 (UTC) Received: by mail-wm1-f45.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so21654299wme.0 for ; Wed, 01 Dec 2021 00:44:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:references:in-reply-to :content-transfer-encoding; bh=qTEXYaj9MBjsUM4lbEpPpdaMaxazPbIwE+2VB6aD08Q=; b=WSk4Mzx3hdQyw+P2KLdEwBk1AhfEdSVLzjEVQCQ+XYsXIpZc8TAIsn0WnLq9gCItgW H3WSDti5izXPSnz5EpvtPyvscGZy3QaDw8t83/sT/g115fjiUEFovZHN348yBCoGhgDk qd4L7Y03Ln0gCJU+zIDZVXdsl0ZaG4btd/1QagH2g3/ipDMTonsLe8pQJHTth5++ewz3 69bK1zNC3aO0LxQ9eFz1Mop6BQTJ2o9BnsOdeZBMdSp309+guovCdYEZLIHbPTkR6226 +udpWPNMbfh5ryaVOabRAQlswM179+9K3W8u4IqQWHYkt8po2X9VNqtf3LUisSYAUWTf W/xQ== X-Gm-Message-State: AOAM530UvxeFAPy/Jyn/LtY541+S7YvdVYljdBia7eufFAhPHMLQEuTF t+hu+R0Mkj7dvwxl4kk6wj6LYGpVm1s= X-Google-Smtp-Source: ABdhPJwj1kf5U6mN8oCjbl6Ugh8VmrqIQ+qSciDIwT1LTp4bu3mmPSDUx8Otd9AeufGDuCSyqCWurA== X-Received: by 2002:a05:600c:1d0e:: with SMTP id l14mr5184200wms.64.1638348286060; Wed, 01 Dec 2021 00:44:46 -0800 (PST) Received: from ?IPV6:2a0b:e7c0:0:107::70f? ([2a0b:e7c0:0:107::70f]) by smtp.gmail.com with ESMTPSA id m14sm25263753wrp.28.2021.12.01.00.44.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Dec 2021 00:44:45 -0800 (PST) Message-ID: Date: Wed, 1 Dec 2021 09:44:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH 3/3] x86: mm: add x86_64 support for page table check Content-Language: en-US From: Jiri Slaby To: Pasha Tatashin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, akpm@linux-foundation.org, rientjes@google.com, pjt@google.com, weixugc@google.com, gthelen@google.com, mingo@redhat.com, corbet@lwn.net, will@kernel.org, rppt@kernel.org, keescook@chromium.org, tglx@linutronix.de, peterz@infradead.org, masahiroy@kernel.org, samitolvanen@google.com, dave.hansen@linux.intel.com, x86@kernel.org, frederic@kernel.org, hpa@zytor.com, aneesh.kumar@linux.ibm.com References: <20211123214814.3756047-1-pasha.tatashin@soleen.com> <20211123214814.3756047-4-pasha.tatashin@soleen.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed X-Stat-Signature: ccc8iouhhgy8uhoirupp5an3xe8cmic5 X-Rspamd-Queue-Id: 26052F0000A1 X-Rspamd-Server: rspam07 Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of jirislaby@gmail.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=jirislaby@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) X-HE-Tag: 1638348287-195000 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 01. 12. 21, 9:00, Jiri Slaby wrote: > On 23. 11. 21, 22:48, Pasha Tatashin wrote: >> Add page table check hooks into routines that modify user page tables. >=20 > Hi, >=20 > I bisected to this as this causes crashes during modules load: And it's not enough to unset CONFIG_PAGE_TABLE_CHECK_ENFORCED. I had to=20 unset CONFIG_PAGE_TABLE_CHECK completely to get rid of this. > #PF: supervisor write access in kernel mode > #PF: error_code(0x0003) - permissions violation > PGD 6d615067 P4D 6d615067 PUD 6d616063 PMD 800000006d2001e1 > Oops: 0003 [#1] PREEMPT SMP PTI > CPU: 0 PID: 6189 Comm: modprobe Kdump: loaded Tainted: G=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 I E =20 > 5.16.0-rc2-next-20211129-vanilla #3=20 > 83846a405f0e3937f5c8dfbc7d449622b8f46369 > Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be=20 > filled by O.E.M., BIOS SDBLI944.86P 05/08/2007 > RIP: 0010:jump_label_module_notify (kernel/jump_label.c:370=20 > kernel/jump_label.c:670 kernel/jump_label.c:748) > Code: 00 48 8b 43 08 a8 02 0f 85 e9 00 00 00 48 83 e0 fc 48 c7 02 00 00= =20 > 00 00 48 89 42 08 48 8b 43 08 83 e0 03 48 09 c2 48 83 ca 02 <48> 89 53=20 > 08 4d 89 66 10 49 89 6e 08 48 8b 43 08 a8 02 0f 84 98 00 > All code > =3D=3D=3D=3D=3D=3D=3D=3D > =C2=A0=C2=A0 0:=C2=A0=C2=A0=C2=A0 00 48 8b=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 add=C2= =A0=C2=A0=C2=A0 %cl,-0x75(%rax) > =C2=A0=C2=A0 3:=C2=A0=C2=A0=C2=A0 43 08 a8 02 0f 85 e9=C2=A0=C2=A0=C2=A0= =C2=A0 rex.XB or %bpl,-0x167af0fe(%r8) > =C2=A0=C2=A0 a:=C2=A0=C2=A0=C2=A0 00 00=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 add=C2=A0=C2=A0=C2=A0 %al,(%rax) > =C2=A0=C2=A0 c:=C2=A0=C2=A0=C2=A0 00 48 83=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 add=C2= =A0=C2=A0=C2=A0 %cl,-0x7d(%rax) > =C2=A0=C2=A0 f:=C2=A0=C2=A0=C2=A0 e0 fc=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=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=C2=A0= 0x8(%rbx),%rax > =C2=A0 10:=C2=A0=C2=A0=C2=A0 a8 02=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 test=C2=A0=C2=A0 $0x2,%al > =C2=A0 12:=C2=A0=C2=A0=C2=A0 0f=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 .byte 0xf > =C2=A0 13:=C2=A0=C2=A0=C2=A0 84=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 .byte 0x84 > =C2=A0 14:=C2=A0=C2=A0=C2=A0 98=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 cwtl > =C2=A0=C2=A0=C2=A0=C2=A0... > RSP: 0018:ffffaf4dc051fbe8 EFLAGS: 00010282 > RAX: 0000000000000001 RBX: ffffffff931ee760 RCX: 0000000000000001 > RDX: ffff9d1aa7d43883 RSI: ffffffff91c50aa0 RDI: ffffffff931ee760 > RBP: ffffffffc0782000 R08: 0000000000000020 R09: 0000000000000000 > R10: ffff9d1aa7d43880 R11: 0000000000000000 R12: ffffffffc079a980 > R13: ffffffffc0784080 R14: ffff9d1aa7d43ca0 R15: ffffffffc0782008 > FS:=C2=A0 00007f87104b8740(0000) GS:ffff9d1b45c00000(0000)=20 > knlGS:0000000000000000 > CS:=C2=A0 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: ffffffff931ee768 CR3: 000000010fdce000 CR4: 00000000000006f0 > Call Trace: > =C2=A0 > blocking_notifier_call_chain_robust (kernel/notifier.c:83=20 > kernel/notifier.c:118 kernel/notifier.c:283 kernel/notifier.c:271) > load_module (./include/linux/notifier.h:198 kernel/module.c:3923=20 > kernel/module.c:4100) > __do_sys_finit_module (kernel/module.c:4224) > do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) > entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:113) >=20 >> Signed-off-by: Pasha Tatashin >> --- >> =C2=A0 arch/x86/Kconfig=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 1 + >> =C2=A0 arch/x86/include/asm/pgtable.h | 29 +++++++++++++++++++++++++++= -- >> =C2=A0 2 files changed, 28 insertions(+), 2 deletions(-) >> >=20 > regards, --=20 js suse labs