Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp397416imm; Thu, 10 May 2018 23:22:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqejBDqJXRapO8UxyWkHHQHPQUE90A6iI3SoVuXmK/4qUBbhwdRYMPbN9OXU5awHFbxnfn/ X-Received: by 2002:a65:5504:: with SMTP id f4-v6mr3358461pgr.177.1526019748270; Thu, 10 May 2018 23:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526019748; cv=none; d=google.com; s=arc-20160816; b=D2irovVIEX8D7uGA2tl2ZYQZHJKHBzviVzcn9+Y5LrKjuT8kXInwckcnkuone3Esu5 pTDWuPagxw8tZkQrfJhOWnikgM/CGH/K9U4J783Mum3tORUZpgXYGiIS22L6YqcdcWxy H2FQRLGdgSSFJu3rKapgTZObAncKdytDsxIhhHhAxw4IpXL34ZVa1L0Lt9S5epeShh/s 0P87g/mn4TCkuTPVoyYbZu3cId1NSeImi200cXKqYq7ASIlfkdcvOKdZNLiUJD/io2t4 ZFeiPz66O72bDniU6YEXoIacf7VRZ1z9B/vBD3jxi9rujfvAOvi6xteiTmdBYqznhf59 hK/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Lftekp7VkINtXvSAbCNbTIQhoposYugzlLYjVzaQgpM=; b=lgfwadv+10R75CJzzIE/R8Wo53/mjQ7XfXIJJtkSVGCLY5b50zdw4qO4x1nLCURvni 572bzQLxEUkkrjzdm5LOWOwpfDQObnFsKM0gmkUcv/NlvEE1oOd5K3/VlajqszqSn0+7 brGj8Z9TIfaiI8zO//jI1C5YmtGxwDnTRpGA+HKe3W+tNkEvaZeob7R2R4kWIiinNuSf /9B4OxVy1wZRYpJURNNULD3eO+N0hskd6eCXZXJ89ZJOykq1gkBKenF+8euWBJ64RmyY Xke1s3xyaFLskfeUQ3Quy3SHlVCrDrfqiPOSSfQhPg5fAqveIhEOdeoUKuuDz2gMi7Bz 1xgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FyhUGBxT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13-v6si2141825pgr.654.2018.05.10.23.22.12; Thu, 10 May 2018 23:22:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FyhUGBxT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752419AbeEKGV6 (ORCPT + 99 others); Fri, 11 May 2018 02:21:58 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:41304 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbeEKGV4 (ORCPT ); Fri, 11 May 2018 02:21:56 -0400 Received: by mail-pf0-f182.google.com with SMTP id v63-v6so2226065pfk.8 for ; Thu, 10 May 2018 23:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Lftekp7VkINtXvSAbCNbTIQhoposYugzlLYjVzaQgpM=; b=FyhUGBxT1NlUCp/WrUVb50K4FjIAgcIEwiDhCTbPAmMtk8SuZ+YpQXi3P+iBk517hW Ys8PG4OKYzWcvuO1wWeUElsVtzqHZxWzx7DqUJ6y518SXw+XaVdRH3NVxFO/uYAOIgCf johm0aEkpshv/pLLiq8LPCsDS4ggEa7wLvbzekgqUxaljr1/xz3+8PPouypHwaw9TPEe LaDoLlMm12N7RM/DmQwWhlDfIXA9/M6HP+AmX3jLg22YTi54WH0ldC+5IJyggFCDDxYP WzrxCu95WBUy4a0KGG0OyP79Xd8Z7IPgX1sEYinOrWuEkNDdPCi3oKK/eVXo41EpmGV0 aNKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Lftekp7VkINtXvSAbCNbTIQhoposYugzlLYjVzaQgpM=; b=Kh67EkfsmkA3DZtLXDOKUsWrXDxuxp7lr0eZQqiOaSg+ghJH8zc9ysTXswdpe+p3l5 lMXdPdmpcwZ9WXvAdHZPZhN+mdCKlTVCUReG4fydcnhvpbeES5A1HvaikhuFjbk+MFyv NDzrZedK+ryyw4vu+3VFoMp1M1T2fFxB9FsPo9unedCuBDPLHN5Jg5hGMJH75ZKC93Oh 3h9wogcJgt8c7fjyqexlQbZXItvGghxsnoBDe5PN1/+LQzhmT7ZS3Gn6HdVbeyQ45won PS/k3lL4UJ1ROLd9ktPbDAa8Bn1O+HVaeCzWnwm4lErhZS2/2RaXPb8vRbtN5wZuPHJr KOGA== X-Gm-Message-State: ALKqPwfhtrIJG6naSxBcbXmkWc/ETnsrbMyHMce4lSRrVwXEfkm55Mph nsgIOdOKkE0qIaa9/Rp4mnA= X-Received: by 2002:a65:43cb:: with SMTP id n11-v6mr3364063pgp.287.1526019716228; Thu, 10 May 2018 23:21:56 -0700 (PDT) Received: from localhost ([211.246.69.73]) by smtp.gmail.com with ESMTPSA id z83-v6sm6771168pfd.103.2018.05.10.23.21.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 10 May 2018 23:21:55 -0700 (PDT) Date: Fri, 11 May 2018 15:21:51 +0900 From: Sergey Senozhatsky To: Tetsuo Handa Cc: Sergey Senozhatsky , pmladek@suse.com, dvyukov@google.com, sergey.senozhatsky@gmail.com, syzkaller@googlegroups.com, rostedt@goodmis.org, fengguang.wu@intel.com, linux-kernel@vger.kernel.org Subject: Re: printk feature for syzbot? Message-ID: <20180511062151.GA18160@jagdpanzerIV> References: <201805102350.JJH73950.tVJHQLFSOMOOFF@I-love.SAKURA.ne.jp> <20180511014515.GA895@jagdpanzerIV> <201805110238.w4B2cIGH079602@www262.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201805110238.w4B2cIGH079602@www262.sakura.ne.jp> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (05/11/18 11:38), Tetsuo Handa wrote: > > > > So you basically want to have one more con_msg_format_flags? Do > > you want to track a context which prints out a messages or the > > context which "generated" the message? A CPU/task that stores > > a logbuf entry - vprintk_emit() - is not always the same as the > > CPU/task that prints it to consoles - console_unlock(). > > > > Well, below is the (partial) patch. Hi, Tetsuo, I will take a look a bit later, but at glance, there are several ways to achieve what you are trying to do. The first one is the way you did it - add additional buffer and make that context tracking info part of the message body. Another one would be to extend struct printk_log and add pid/cpu/flag there, which you then can convert into text in msg_print_text(). So far we talked about extending printk_log. Yet another one could be - add vsprintf specifiers that would add pid/cpu/flag to the vsprintf-ed message. You then can re-define pr_fmt, for instance, in the code you want to track pr_fmt "%zZ" fmt, or somehow force printk to add that "%zZ" to every message. > By the way, when I tried to make similar change for printk_safe_log_store(), > I noticed that printk_safe_log_store() is not safe because it is reusing > the va_list variable after "goto again;". We need to use va_copy(), or > we will get crash like an example shown below. Oh, right. Can you send a patch? -ss