From 28a963f266a57308ceb6903da238acf008e628bf Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 1 Oct 2014 15:30:50 -0500 Subject: [PATCH] LU-5635 llog: prevent out-of-bound index llog_process_thread() can be called from llog_cat_process_cb with an index already out of bound, leading to the following crash: LustreError: 3773:0:(llog.c:310:llog_process_thread()) ASSERTION(index <= last_index + 1 ) failed: LustreError: 3773:0:(llog.c:310:llog_process_thread()) LBUG #0 [ffff8801144bf900] machine_kexec at ffffffff81038f3b #1 [ffff8801144bf960] crash_kexec at ffffffff810c5d82 #2 [ffff8801144bfa30] panic at ffffffff8152798a #3 [ffff8801144bfab0] lbug_with_loc at ffffffffa02f8eeb [libcfs] #4 [ffff8801144bfad0] llog_process_thread at ffffffffa0413fff [obdclass] #5 [ffff8801144bfb80] llog_process_or_fork at ffffffffa041585f [obdclass] #6 [ffff8801144bfbd0] llog_cat_process_cb at ffffffffa0418612 [obdclass] #7 [ffff8801144bfc30] llog_process_thread at ffffffffa0413c22 [obdclass] #8 [ffff8801144bfce0] llog_process_or_fork at ffffffffa041585f [obdclass] #9 [ffff8801144bfd30] llog_cat_process_or_fork at ffffffffa0416b9d [obdclass] RIP: 00007f6de5e4f730 RSP: 00007fff9aa26d98 RFLAGS: 00000206 RAX: 0000000000000000 RBX: ffffffff8100b072 RCX: 00007f6de5e4f730 RDX: 0000000000008000 RSI: 00000000019c7000 RDI: 0000000000000003 RBP: 00000000019c7000 R8: 00007f6de6103ee8 R9: 0000000000000001 R10: 00007fff9aa26b20 R11: 0000000000000246 R12: ffffffffffff8000 R13: 0000000000000003 R14: 0000000000008000 R15: 0000000000000003 ORIG_RAX: 0000000000000000 CS: 0033 SS: 002b If index is too big, simply return success. Change-Id: I81bbedbbe2bcef478c370ef40fc069447d39efbd Signed-off-by: frank zago Reviewed-on: http://review.whamcloud.com/12161 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Patrick Farrell Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/obdclass/llog.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index a4fbc25..2f3b9e4 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -301,6 +301,11 @@ static int llog_process_thread(void *arg) else last_index = LLOG_BITMAP_BYTES * 8 - 1; + if (index > last_index) { + /* Record is not in this buffer. */ + GOTO(out, rc); + } + while (rc == 0) { struct llog_rec_hdr *rec; -- 1.8.3.1