Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751678AbdHPJVn (ORCPT ); Wed, 16 Aug 2017 05:21:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:53398 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751196AbdHPJVl (ORCPT ); Wed, 16 Aug 2017 05:21:41 -0400 Date: Wed, 16 Aug 2017 11:21:39 +0200 From: Petr Mladek To: pierre kuo Cc: Sergey Senozhatsky , Sergey Senozhatsky , rostedt@goodmis.org, linux-kernel@vger.kernel.org Subject: Re: [RFC V2] printk: add warning while drop partial text in msg Message-ID: <20170816092139.GA30544@pathway.suse.cz> References: <1501421870-12042-1-git-send-email-vichy.kuo@gmail.com> <20170801024303.GA469@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1272 Lines: 30 On Fri 2017-08-11 00:55:48, pierre kuo wrote: > hi Sergey: > (Please ignore previous mail, I apologize for pressing send button too early :) > >> this is not the only place that can truncate the message. > >> vprintk_emit() can do so as well /* vscnprintf() */. but > >> I think we don't care that much. a user likely will notice > >> truncated messages. we report lost messages, because this > >> is a completely different sort of problem. > Usually people will more easily find message truncated from semantics > by vscnprintf, since it brute force truncate input message by the > upper limit of output buffer. Do you see the problem in the real life, please? I ask because msg_print_text() seems to be used carefully. For example, syslog_idx is bumped in syslog_print() only when the message fits into the buffer. It repeats the read with an empty buffer until the bigger userspace buffer is full. Also kmsg_dump_get_buffer() first checks the size of the messages. Then it calls msg_print_text() only for messages that fit into the buffer. These functions are called from userspace. Of course, all messages do not fit into the userspace buffer. But userspace repeats the read until all messages are read. IMHO, nothing is really dropped here. Best Regards, Petr