Re: [PATCH 0/2] printk: replace ringbuffer

From: John Ogness
Date: Fri Feb 07 2020 - 02:43:48 EST


On 2020-02-07, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> The quick fixup:
>>
>> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
>> index d0d24ee1d1f4..5ad67ff60cd9 100644
>> --- a/kernel/printk/printk.c
>> +++ b/kernel/printk/printk.c
>> @@ -883,6 +883,7 @@ static int devkmsg_open(struct inode *inode, struct file *file)
>> user->record.text_buf_size = sizeof(user->text_buf);
>> user->record.dict_buf = &user->dict_buf[0];
>> user->record.dict_buf_size = sizeof(user->dict_buf);
>> + user->record.text_line_count = NULL;
>>
>> logbuf_lock_irq();
>> user->seq = prb_first_seq(prb);
>
> FYI, I used your patch set to test out Konstantin's new get-lore-mbox
> script, and then applied them. It locked up on boot up as well, and
> applying this appears to fix it.

Yes, this is a horrible bug. In preparation for my v2 I implemented:

prb_rec_init_rd()
prb_rec_init_wr()

as static inline functions to initialize the records. There is a reader
and writer variant because they initialize the records differently:
readers provide buffers, writers request buffers. This eliminates the
manual twiddling with the record struct and ensures that the struct is
always properly initialized.

John Ogness