From 24434443f8d92866a6743ee34819b38cccb57493 Mon Sep 17 00:00:00 2001 From: Sidharth Kshatriya Date: Thu, 7 Nov 2024 20:56:24 +0530 Subject: [PATCH] AddressSpace::verify() should not be infallible --- src/AddressSpace.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AddressSpace.cc b/src/AddressSpace.cc index b0c18f31549..eefe4980228 100644 --- a/src/AddressSpace.cc +++ b/src/AddressSpace.cc @@ -1757,7 +1757,11 @@ void AddressSpace::verify(Task* t) const { LOG(debug) << "Verifying address space for task " << t->tid; MemoryMap::const_iterator mem_it = mem.begin(); - KernelMapIterator kernel_it(t); + bool ok = false; + // Must pass ok parameter otherwise KernelMapIterator constructor will become + // infallible if /proc/[tid]/maps cannot be opened + KernelMapIterator kernel_it(t, &ok); + // checking at_end() is equivalent to checking if ok if (kernel_it.at_end()) { LOG(debug) << "Task " << t->tid << " exited unexpectedly, ignoring"; return;