From nobody Tue Dec 30 09:54:23 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A83DBC5ACB3 for ; Thu, 16 Nov 2023 20:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345534AbjKPUQC (ORCPT ); Thu, 16 Nov 2023 15:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345396AbjKPUP6 (ORCPT ); Thu, 16 Nov 2023 15:15:58 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A62E6131 for ; Thu, 16 Nov 2023 12:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700165753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K5Hs9QdfwrjJDDWeQ9cxEQGj2Q5OwzhPOjdAfeINdzY=; b=Ht139EY9bgY4hLQn0dJcnFqesDIAwPtigeCY7vvmzJnvaN9pBIjOFTLRfaq/d9GmtRqOfa 7hVeS6+ZJpMj4j3Acr7dK/emKLQTADVCujwDQZanCe0/jj/AVxOz2wOUtBbqeLvX/xa+p6 536DAgj00N8xlQNiYTLGE7jAyBcxoCY= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-eEapdL2RNEexFak4aCs0gw-1; Thu, 16 Nov 2023 15:15:52 -0500 X-MC-Unique: eEapdL2RNEexFak4aCs0gw-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-66ffa15d354so3241316d6.0 for ; Thu, 16 Nov 2023 12:15:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700165752; x=1700770552; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K5Hs9QdfwrjJDDWeQ9cxEQGj2Q5OwzhPOjdAfeINdzY=; b=Gz6pvDvpkJ6vIg5+/j5OA4jdggLdYS0NfMQGmToZxxPvg9MJIz20uksomsyGoRxsRq gSfKac7y8hqwh6CMWydTouD2Zri/N8IIaYJK67+sHsaW1l2cNK/aM66rL6TVVWNYom1F 3dqFU9U5snRBHk7TYDvEPaEgg/B0TBd5XK6sM4iymoSr2C1NOsppWtgm7q7tdnUU4Bh9 LC4A0VBacqOAWWhRh86G4JNSbbpRmrNL19ui63nVs6V07I3wBGwURWNcYlJOD8leiiWF tbPzqb2BcHRiQzHjJSHX0rJLR0r80S8DuwoCvtYI4FnfigLHD/vhATm6pVs/SppMk7Em Bgzw== X-Gm-Message-State: AOJu0YzMTsAzEHZhdzEmfJ+v3HIITmWZouenjGv5NcgX3hdHnX74BEmZ jH5jWOUd/nSKTyfMy7cQ9ifgh7DgiYpeSiooKuV0Y9bwNqQHwvr5O+NxzTMcZqyUWe0pd57mq3L gyHT3+zj5WB637Ku6YVuwa4zR X-Received: by 2002:a05:620a:4687:b0:76d:9234:1db4 with SMTP id bq7-20020a05620a468700b0076d92341db4mr10712155qkb.7.1700165751876; Thu, 16 Nov 2023 12:15:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmDFvQLKh+9k0oT4EBKFDQfAkcZ4rcK4Q8PBCrNJ52LzF+uNq5CMglTWczZ0GdgxJefrjWuw== X-Received: by 2002:a05:620a:4687:b0:76d:9234:1db4 with SMTP id bq7-20020a05620a468700b0076d92341db4mr10712123qkb.7.1700165751543; Thu, 16 Nov 2023 12:15:51 -0800 (PST) Received: from x1n.redhat.com (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id b19-20020a05620a271300b007659935ce64sm65524qkp.71.2023.11.16.12.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:15:50 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Muhammad Usama Anjum , Andrew Morton , David Hildenbrand , Andrei Vagin , syzbot+e94c5aaf7890901ebf9b@syzkaller.appspotmail.com Subject: [PATCH 1/3] mm/pagemap: Fix ioctl(PAGEMAP_SCAN) on vma check Date: Thu, 16 Nov 2023 15:15:45 -0500 Message-ID: <20231116201547.536857-2-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116201547.536857-1-peterx@redhat.com> References: <20231116201547.536857-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The new ioctl(PAGEMAP_SCAN) relies on vma wr-protect capability provided by userfault, however in the vma test it didn't explicitly require the vma to have wr-protect function enabled, even if PM_SCAN_WP_MATCHING flag is set. It means the pagemap code can now apply uffd-wp bit to a page in the vma even if not registered to userfaultfd at all. Then in whatever way as long as the pte got written and page fault resolved, we'll apply the write bit even if uffd-wp bit is set. We'll see a pte that has both UFFD_WP and WRITE bit set. Anything later that looks up the pte for uffd-wp bit will trigger the warning: WARNING: CPU: 1 PID: 5071 at arch/x86/include/asm/pgtable.h:403 pte_uffd_wp= arch/x86/include/asm/pgtable.h:403 [inline] Fix it by doing proper check over the vma attributes when PM_SCAN_WP_MATCHING is specified. Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optional= ly clear info about PTEs") Reported-by: syzbot+e94c5aaf7890901ebf9b@syzkaller.appspotmail.com Signed-off-by: Peter Xu Reviewed-by: Andrei Vagin Reviewed-by: David Hildenbrand Reviewed-by: Muhammad Usama Anjum --- fs/proc/task_mmu.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 51e0ec658457..e91085d79926 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1994,15 +1994,31 @@ static int pagemap_scan_test_walk(unsigned long sta= rt, unsigned long end, struct pagemap_scan_private *p =3D walk->private; struct vm_area_struct *vma =3D walk->vma; unsigned long vma_category =3D 0; + bool wp_allowed =3D userfaultfd_wp_async(vma) && + userfaultfd_wp_use_markers(vma); =20 - if (userfaultfd_wp_async(vma) && userfaultfd_wp_use_markers(vma)) - vma_category |=3D PAGE_IS_WPALLOWED; - else if (p->arg.flags & PM_SCAN_CHECK_WPASYNC) - return -EPERM; + if (!wp_allowed) { + /* User requested explicit failure over wp-async capability */ + if (p->arg.flags & PM_SCAN_CHECK_WPASYNC) + return -EPERM; + /* + * User requires wr-protect, and allows silently skipping + * unsupported vmas. + */ + if (p->arg.flags & PM_SCAN_WP_MATCHING) + return 1; + /* + * Then the request doesn't involve wr-protects at all, + * fall through to the rest checks, and allow vma walk. + */ + } =20 if (vma->vm_flags & VM_PFNMAP) return 1; =20 + if (wp_allowed) + vma_category |=3D PAGE_IS_WPALLOWED; + if (vma->vm_flags & VM_SOFTDIRTY) vma_category |=3D PAGE_IS_SOFT_DIRTY; =20 --=20 2.41.0 From nobody Tue Dec 30 09:54:23 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F00D1C197A0 for ; Thu, 16 Nov 2023 20:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345537AbjKPUQG (ORCPT ); Thu, 16 Nov 2023 15:16:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjKPUP7 (ORCPT ); Thu, 16 Nov 2023 15:15:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6389E131 for ; Thu, 16 Nov 2023 12:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700165755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rVI0G/o2WVlv6Ps9x/muR3n3l0/Wk8HAmms0O3t+e7A=; b=HSAVCuIL2t2DIYS831ApH1+gEOYQlD8DqMveKP01DunmehYWIFpNZfofwQbQSu291ND2cT tpZaY24vWxpGwIHOTAI0tdQleBFj5NXh8nms2vfljz5b2+4plg81qROn6t0Q7alBbXd1ZU xvJGD+rIMou1o8SwnrqPn+MRpNAgWzk= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-HvXjgfiSOzOKR2awrTdG0Q-1; Thu, 16 Nov 2023 15:15:53 -0500 X-MC-Unique: HvXjgfiSOzOKR2awrTdG0Q-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-77a02ceef95so18075885a.0 for ; Thu, 16 Nov 2023 12:15:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700165753; x=1700770553; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rVI0G/o2WVlv6Ps9x/muR3n3l0/Wk8HAmms0O3t+e7A=; b=TfLa/imSRczWOZpalZyVQcnsiHc7mBJSsFhsp4mngLpN0vdNdFVhv+3HYmRd6lz9S3 xMfYZ0Xa+fVku6dpxoNcXRcp/YcXCvvcTpJNuAxDjz3sA6KxL+Ru6UryTVgou0mvz85F GSYJRhfJjol2gRG+/ustFekZaG7yC5Q6hc0pgaELiVbSW4yqYXHIWvjMxkR7hsOYGKuj yHLAxwhphp9BUNSg7T2rk5EcdI9DuNjWnGbjVcKtDFs4b6580P74Ag7pscLBHdphXmIc ZPQE0KeL7/XCKmxJU+Y02hEQUoKMeD1XcqB4MaORvZ0k8ApGL5AY5oviVlQ3jsMk/U6l +tDA== X-Gm-Message-State: AOJu0Yz/0uF7AGf2BERCNcBFkzbvt7ThIR4pW8JTY2a6+U9MPhnmyC9M N1ky+TbZDO1Hif32v0OTkubOK5uBYCQx7WruQumDoVhBuxFTYcyeDP6g7GDLCZz1S+nTwOE6Ms/ 6N+0mx8qskHsOxaBx/osIGQyR X-Received: by 2002:a05:620a:bd3:b0:772:5300:1c3d with SMTP id s19-20020a05620a0bd300b0077253001c3dmr9471538qki.0.1700165753215; Thu, 16 Nov 2023 12:15:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6NhVg5ATijtU5gZAjIsSdXlgC1Wv7DJob8yOxfAJNeWszVXZfkcVZW+Oo0riZTR5pk+BEJA== X-Received: by 2002:a05:620a:bd3:b0:772:5300:1c3d with SMTP id s19-20020a05620a0bd300b0077253001c3dmr9471523qki.0.1700165752989; Thu, 16 Nov 2023 12:15:52 -0800 (PST) Received: from x1n.redhat.com (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id b19-20020a05620a271300b007659935ce64sm65524qkp.71.2023.11.16.12.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:15:52 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Muhammad Usama Anjum , Andrew Morton , David Hildenbrand , Andrei Vagin , syzbot+7ca4b2719dc742b8d0a4@syzkaller.appspotmail.com Subject: [PATCH 2/3] mm/pagemap: Fix wr-protect even if PM_SCAN_WP_MATCHING not set Date: Thu, 16 Nov 2023 15:15:46 -0500 Message-ID: <20231116201547.536857-3-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116201547.536857-1-peterx@redhat.com> References: <20231116201547.536857-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The new pagemap ioctl contains a fast path for wr-protections without looking into category masks. It forgets to check PM_SCAN_WP_MATCHING before applying the wr-protections. It can cause, e.g., pte markers installed on archs that do not even support uffd wr-protect. WARNING: CPU: 0 PID: 5059 at mm/memory.c:1520 zap_pte_range mm/memory.c:152= 0 [inline] Fixes: 12f6b01a0bcb ("fs/proc/task_mmu: add fast paths to get/clear PAGE_IS= _WRITTEN flag") Reported-by: syzbot+7ca4b2719dc742b8d0a4@syzkaller.appspotmail.com Signed-off-by: Peter Xu Reviewed-by: Andrei Vagin Reviewed-by: David Hildenbrand --- fs/proc/task_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e91085d79926..d19924bf0a39 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2171,7 +2171,7 @@ static int pagemap_scan_pmd_entry(pmd_t *pmd, unsigne= d long start, return 0; } =20 - if (!p->vec_out) { + if ((p->arg.flags & PM_SCAN_WP_MATCHING) && !p->vec_out) { /* Fast path for performing exclusive WP */ for (addr =3D start; addr !=3D end; pte++, addr +=3D PAGE_SIZE) { if (pte_uffd_wp(ptep_get(pte))) --=20 2.41.0 From nobody Tue Dec 30 09:54:23 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CE29C47071 for ; Thu, 16 Nov 2023 20:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345544AbjKPUQJ (ORCPT ); Thu, 16 Nov 2023 15:16:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbjKPUP7 (ORCPT ); Thu, 16 Nov 2023 15:15:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B361AD for ; Thu, 16 Nov 2023 12:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700165756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; b=EMx+bDzk8Nr6qdAyyHWiJIBCZsczcUAeVyoyfOnK7j09Dx0o3tGzSJJCquD6Cz1ihDUGAf JT0HHJwk4/AfoDhrwMAauPtQmzUsz8f5AgNWITHtHtSrFhFjXKJrugQ9C/1JawY77aYj1l AAVX7Yom9diVSfpqjEI3NswuF9l+ZL4= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-tfgHdjaBOQGR7f3JsXbUXQ-1; Thu, 16 Nov 2023 15:15:54 -0500 X-MC-Unique: tfgHdjaBOQGR7f3JsXbUXQ-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-77a02ceef95so18076385a.0 for ; Thu, 16 Nov 2023 12:15:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700165754; x=1700770554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QIfhkJ5q+MuBUNqDP7+llj85JgVyRPSym9vvMGwkwM8=; b=njd9H8AZLVpERM9UglB7S0bIz6/cg74E57X9V/jQUdQnJ6k5UM/BtceOhsJG4NiADj FXuKG04svL3kjY+hmneJ2uqCfxrfFpAECoTfhD4nubOi0CdtGyGn6dQnbXJH7B+TFlxB 93tXymbKZyZWGY082sJWfLR6XOjDjg5LVxN6SyG2LqLi7pO4CKVEZ94hp6EoTaCkxkhh PHj7aPnBVZEwt0r7WOp3Y0pt60lmOwXi+RWcgd3vNSMFzDSzv2Io2vOEibt8IqXh9E+X oetBNT+htpe/A1dDBTzh53/rgT82MmxGPkBsYmi79aqshNDARSFCbDDi3P7bdZ0Btbcp 9ZJg== X-Gm-Message-State: AOJu0Yy7Eci+Q4VuIpONnnc9mZT4ykYTUSaGJ/6Pndh5jeLszd49mUQS lobd2RIzJ9P9dIv1kkXm50wKRUSvaP8WKK9jB/z5Ura81DeljrN2M+BZxpY/jlO8zuxK8kqg4n7 vlapXNR78kzUonyByvZnlpdB4 X-Received: by 2002:a05:620a:460f:b0:777:7178:ebf0 with SMTP id br15-20020a05620a460f00b007777178ebf0mr10983525qkb.5.1700165754345; Thu, 16 Nov 2023 12:15:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFn7WTMLEwrbmDqREYqOP32v0nHbLxAxhRbfg6zZ9i1WFQBXOXwxoGfistYIkGysffqZC/jBw== X-Received: by 2002:a05:620a:460f:b0:777:7178:ebf0 with SMTP id br15-20020a05620a460f00b007777178ebf0mr10983511qkb.5.1700165754044; Thu, 16 Nov 2023 12:15:54 -0800 (PST) Received: from x1n.redhat.com (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id b19-20020a05620a271300b007659935ce64sm65524qkp.71.2023.11.16.12.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:15:53 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, Muhammad Usama Anjum , Andrew Morton , David Hildenbrand , Andrei Vagin Subject: [PATCH 3/3] mm/selftests: Fix pagemap_ioctl memory map test Date: Thu, 16 Nov 2023 15:15:47 -0500 Message-ID: <20231116201547.536857-4-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116201547.536857-1-peterx@redhat.com> References: <20231116201547.536857-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" __FILE__ is not guaranteed to exist in current dir. Replace that with argv[0] for memory map test. Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests") Signed-off-by: Peter Xu Reviewed-by: David Hildenbrand --- tools/testing/selftests/mm/pagemap_ioctl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/sel= ftests/mm/pagemap_ioctl.c index befab43719ba..d59517ed3d48 100644 --- a/tools/testing/selftests/mm/pagemap_ioctl.c +++ b/tools/testing/selftests/mm/pagemap_ioctl.c @@ -36,6 +36,7 @@ int pagemap_fd; int uffd; int page_size; int hpage_size; +const char *progname; =20 #define LEN(region) ((region.end - region.start)/page_size) =20 @@ -1149,11 +1150,11 @@ int sanity_tests(void) munmap(mem, mem_size); =20 /* 9. Memory mapped file */ - fd =3D open(__FILE__, O_RDONLY); + fd =3D open(progname, O_RDONLY); if (fd < 0) ksft_exit_fail_msg("%s Memory mapped file\n", __func__); =20 - ret =3D stat(__FILE__, &sbuf); + ret =3D stat(progname, &sbuf); if (ret < 0) ksft_exit_fail_msg("error %d %d %s\n", ret, errno, strerror(errno)); =20 @@ -1472,12 +1473,14 @@ static void transact_test(int page_size) extra_thread_faults); } =20 -int main(void) +int main(int argc, char *argv[]) { int mem_size, shmid, buf_size, fd, i, ret; char *mem, *map, *fmem; struct stat sbuf; =20 + progname =3D argv[0]; + ksft_print_header(); =20 if (init_uffd()) --=20 2.41.0