lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <163309905120.80461.1932497502647013780.stgit@warthog.procyon.org.uk>
Date:   Fri, 01 Oct 2021 15:37:31 +0100
From:   David Howells <dhowells@...hat.com>
To:     torvalds@...ux-foundation.org
Cc:     Dave Wysochanski <dwysocha@...hat.com>, linux-cachefs@...hat.com,
        dhowells@...hat.com, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] cachefiles: Fix oops in trace_cachefiles_mark_buried due to
 NULL object

From: Dave Wysochanski <dwysocha@...hat.com>

In cachefiles_mark_object_buried, the dentry in question may
not have an owner, and thus our cachefiles_object pointer
may be NULL when calling the tracepoint, in which case we
will also not have a valid debug_id to print in the tracepoint.
Check for NULL object in the tracepoint and if so, just set
debug_id to MAX_UINT as was done in 2908f5e101e3.

This fixes the following oops:

    FS-Cache: Cache "mycache" added (type cachefiles)
    CacheFiles: File cache on vdc registered
    ...
    Workqueue: fscache_object fscache_object_work_func [fscache]
    RIP: 0010:trace_event_raw_event_cachefiles_mark_buried+0x4e/0xa0 [cachefiles]
    ....
    Call Trace:
     cachefiles_mark_object_buried+0xa5/0xb0 [cachefiles]
     cachefiles_bury_object+0x270/0x430 [cachefiles]
     ? kfree+0xaa/0x3a0
     ? vfs_getxattr+0x15a/0x180
     cachefiles_walk_to_object+0x195/0x9c0 [cachefiles]
     ? trace_event_buffer_commit+0x61/0x220
     cachefiles_lookup_object+0x5a/0xc0 [cachefiles]
     fscache_look_up_object+0xd7/0x160 [fscache]
     fscache_object_work_func+0xb2/0x340 [fscache]
     process_one_work+0x1f1/0x390
     worker_thread+0x53/0x3e0
     ? process_one_work+0x390/0x390
     kthread+0x127/0x150
     ? set_kthread_struct+0x40/0x40
     ret_from_fork+0x22/0x30

Fixes: 2908f5e101e3 ("fscache: Add a cookie debug ID and use that in traces")
Signed-off-by: Dave Wysochanski <dwysocha@...hat.com>
Signed-off-by: David Howells <dhowells@...hat.com>
cc: linux-cachefs@...hat.com
---

 include/trace/events/cachefiles.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/cachefiles.h b/include/trace/events/cachefiles.h
index 9a448fe9355d..695bfdbfdcad 100644
--- a/include/trace/events/cachefiles.h
+++ b/include/trace/events/cachefiles.h
@@ -305,7 +305,7 @@ TRACE_EVENT(cachefiles_mark_buried,
 			     ),
 
 	    TP_fast_assign(
-		    __entry->obj	= obj->fscache.debug_id;
+		    __entry->obj	= obj ? obj->fscache.debug_id : UINT_MAX;
 		    __entry->de		= de;
 		    __entry->why	= why;
 			   ),


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ