From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB2CCA9EB5 for ; Mon, 21 Oct 2019 09:25:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 54E0720684 for ; Mon, 21 Oct 2019 09:25:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54E0720684 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 02A4C6B0003; Mon, 21 Oct 2019 05:25:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1C0E6B0005; Mon, 21 Oct 2019 05:25:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E31366B0006; Mon, 21 Oct 2019 05:25:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id BCCC76B0003 for ; Mon, 21 Oct 2019 05:25:55 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 49EDB180AD822 for ; Mon, 21 Oct 2019 09:25:55 +0000 (UTC) X-FDA: 76067259870.29.loaf33_8af761228cc09 X-HE-Tag: loaf33_8af761228cc09 X-Filterd-Recvd-Size: 3936 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Oct 2019 09:25:54 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DF351B3F7; Mon, 21 Oct 2019 09:25:52 +0000 (UTC) Date: Mon, 21 Oct 2019 11:25:51 +0200 From: Petr Mladek To: glider@google.com Cc: Andrew Morton , Greg Kroah-Hartman , Eric Dumazet , Wolfram Sang , Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org, Sergey Senozhatsky , Steven Rostedt Subject: Re: [PATCH RFC v1 19/26] kmsan: call KMSAN hooks where needed Message-ID: <20191021092551.lf5hadk2kigzwveo@pathway.suse.cz> References:<20191018094304.37056-1-glider@google.com> <20191018094304.37056-20-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To:<20191018094304.37056-20-glider@google.com> User-Agent: NeoMutt/20170912 (1.9.0) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 2019-10-18 11:42:57, glider@google.com wrote: > Insert KMSAN hooks that check for potential memory errors and/or make > necessary bookkeeping changes: > - allocate/split/deallocate metadata pages in > alloc_pages()/split_page()/free_page(); > - clear page shadow and origins in clear_page(), copy_user_highpage(); > - copy page metadata in copy_highpage(), wp_page_copy(); > - handle vmap()/vunmap()/iounmap(); > - handle task creation and deletion; > - handle vprintk(); I looked only at the printk part. > - call softirq entry/exit hooks in kernel/softirq.c; > - check/initialize memory sent to/read from USB, I2C, and network > > Signed-off-by: Alexander Potapenko > To: Alexander Potapenko > Cc: Andrew Morton > Cc: Greg Kroah-Hartman > Cc: Eric Dumazet > Cc: Wolfram Sang > Cc: Petr Mladek > Cc: Vegard Nossum > Cc: Dmitry Vyukov > Cc: linux-mm@kvack.org Could you please add into CC also the other printk co-maitainers? + Sergey Senozhatsky + Steven Rostedt > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index ca65327a6de8..f77fdcb5f861 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1914,7 +1914,12 @@ int vprintk_store(int facility, int level, > * The printf needs to come first; we need the syslog > * prefix which might be passed-in as a parameter. > */ > - text_len = vscnprintf(text, sizeof(textbuf), fmt, args); > + /* > + * We've checked the printk arguments in vprintk_emit() already. > + * Initialize |text_len| to prevent the errors from spreading. > + */ > + text_len = KMSAN_INIT_VALUE(vscnprintf(text, sizeof(textbuf), fmt, > + args)); I am a bit confused by the comment. What is the exact meaning of KMSAN_INIT_VALUE(), please? Does it prevent checking fmt again? Does make the text_len variable special? In which way? > /* mark and strip a trailing newline */ > if (text_len && text[text_len-1] == '\n') { > @@ -1972,6 +1977,7 @@ asmlinkage int vprintk_emit(int facility, int level, > boot_delay_msec(level); > printk_delay(); > > + kmsan_handle_vprintk(&fmt, args); What does this function, please? Could I find more details in another patch? > /* This stops the holder of console_sem just where we want him */ > logbuf_lock_irqsave(flags); > curr_log_seq = log_next_seq; Best Regards, Petr