Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2025 04:52:02 GMT
From:      Romain =?utf-8?Q?Tarti=C3=A8re?= <romain@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: aa326b970e36 - stable/14 - vm_page: Fix handling of empty bad memory addresses file
Message-ID:  <202508110452.57B4q2uq071509@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by romain:

URL: https://cgit.FreeBSD.org/src/commit/?id=aa326b970e36d063abc653071ca5fccdf83e5554

commit aa326b970e36d063abc653071ca5fccdf83e5554
Author:     Romain Tartière <romain@FreeBSD.org>
AuthorDate: 2025-08-03 05:42:23 +0000
Commit:     Romain Tartière <romain@FreeBSD.org>
CommitDate: 2025-08-11 04:50:54 +0000

    vm_page: Fix handling of empty bad memory addresses file
    
    If a file with bad memory addresses is configured but that file is
    empty (0 lines, 0 bytes), when loading it we end up returning an end
    pointer that is just _before_ the start of the (empty) file content.
    
    Adjust the code to make it clear what pre-condition are required to set
    the *list / *end pointers correctly, and explicitly set them to NULL
    when they are not matched.
    
    Reported by:    marklmi@yahoo.com
    Reviewed by:    kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D51717
    
    (cherry picked from commit f90940ce6eb71df40538c35a65d77ad3093c679a)
---
 sys/vm/vm_page.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index f013cbc84c25..1da7ddce86a6 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -391,11 +391,15 @@ vm_page_blacklist_load(char **list, char **end)
 		ptr = preload_fetch_addr(mod);
 		len = preload_fetch_size(mod);
         }
-	*list = ptr;
-	if (ptr != NULL)
+
+	if (ptr != NULL && len > 0) {
+		*list = ptr;
 		*end = ptr + len - 1;
-	else
+	} else {
+		*list = NULL;
 		*end = NULL;
+	}
+
 	return;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202508110452.57B4q2uq071509>