Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1188132ybg; Thu, 4 Jun 2020 03:26:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5EkwmcSguC9M4AIcMeMtpESudHG24jE7xc2nmXcXhVeTNkltSf7+ec2ANuJX/rmt7EjJP X-Received: by 2002:a05:6402:1ca2:: with SMTP id cz2mr3473907edb.15.1591266386265; Thu, 04 Jun 2020 03:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591266386; cv=none; d=google.com; s=arc-20160816; b=z/AtCZriswwdErtqinef5GMUIvH+M7XadbDRHQNPxXPTQvdG/kXljj34oJBG537b52 wq0ipf/ugaIKE4iybaQ6OeI8vnYNgQy9D+pfnhj3cwKjgtNWfXaABQT7Zdde8flJq3QL WzeFwzzpbVQ84p6UVF2lZwAf+F5DpjLKjx1Xnv99VM85W/F6JaEZPxqnzO/EyyW2ZTGi KThPYrwgwt9HTaf1tdzaTQ05qI4PnC3qotrNBUX1be/9psq7pMJQ8Fnubd+UcZjl/RtP 1ZcDizvj/cPQoW7csNBgOQW7n2ruqjiYjR+3YUHmXZr81Iag/E1V/Mry/rWeDzNbyshh FsSA== 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; bh=00iVgV9Ep0XIU0dPpebkC1rW/LSI6oT+0FLLQRSEUfE=; b=oNAfg+Ch+45TkHi0XnmtbgosJNDTk/K4soPBoenpoJSZT+rk9Fxt984Zf5BFtFoOzJ 0WDZjKD2DSj4Hv3jTVyXS2+9rntxYtbczohVIyJb23AacG66M4DX1Hl3eDbGix1XTTfl g/jSgW7gXWaG4wEIhijuobPNqF6HytMrKKSOO+L1f9uKt6nQjscNctujIjy2dwIPrBHA hK/FbfQP66yG9ZkA8c3rDQSXVSpQO7CXVqo/eKAdRPcWiyFdENtrPWKYi/2YtV/Q1mT4 Cqs1t1Wkzpco+jFfx4ljrBR8843APXEuksJMJ0rBb8Yx7Lw6izr+eg1RUeKULYzbcm94 rF+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si1420252edi.116.2020.06.04.03.26.02; Thu, 04 Jun 2020 03:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728161AbgFDKV4 (ORCPT + 99 others); Thu, 4 Jun 2020 06:21:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:59650 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgFDKVz (ORCPT ); Thu, 4 Jun 2020 06:21:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 981CAB178; Thu, 4 Jun 2020 10:21:56 +0000 (UTC) Date: Thu, 4 Jun 2020 12:21:52 +0200 From: Petr Mladek To: Tetsuo Handa Cc: Dmitry Vyukov , syzkaller , Linus Torvalds , Andrew Morton , Linux Kernel Mailing List , Ondrej Mosnacek , Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman Subject: Re: twist: allow disabling reboot request Message-ID: <20200604102152.GE22497@linux-b0ei> References: <13b0a475-e70e-c490-d34d-0c7a34facf7c@i-love.sakura.ne.jp> <6116ed2e-cee1-d82f-6b68-ddb1bbb6abe2@i-love.sakura.ne.jp> <19d377d3-8037-8090-0f99-447f72cc1d8c@i-love.sakura.ne.jp> <38df9737-3c04-dca2-0df4-115a9c1634e5@i-love.sakura.ne.jp> <51eaa6cd-33ce-f9d8-942c-c797c0ec6733@i-love.sakura.ne.jp> <20200603124405.GA22497@linux-b0ei> <9203e56c-1d84-bfce-b2d8-b2395ef0168a@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9203e56c-1d84-bfce-b2d8-b2395ef0168a@i-love.sakura.ne.jp> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2020-06-03 22:35:02, Tetsuo Handa wrote: > On 2020/06/03 21:44, Petr Mladek wrote: > > On Wed 2020-06-03 20:03:28, Tetsuo Handa wrote: > >> On 2020/05/29 22:26, Tetsuo Handa wrote: > >>> By the way, I do worry that people forget to perform these steps when they do > >>> their tests without asking syzbot... > >> > >> Here is a draft of boot-time switching. Since kconfig can handle string variable up to > >> 2048 characters, we could hold the content of the "your-config" file inside .config file > >> in order to avoid relying on external file in "syzkaller tree". But since only one kconfig > >> option is used, basically the way to temporarily include/exclude specific options (under > >> automated testing by syzbot) seems to remain directly patching apply_twist_flags(), for > >> https://github.com/google/syzkaller/blob/master/dashboard/config/util.sh will automatically > >> overwrite CONFIG_DEFAULT_TWIST_FLAGS settings. If each twist flag were using independent > >> kconfig option, the way to temporarily include/exclude specific options will become directly > >> patching Kconfig file. > >> > >> diff --git a/include/linux/kernel.h b/include/linux/kernel.h > >> index 82d91547d122..78fdbb4f17b1 100644 > >> --- a/include/linux/kernel.h > >> +++ b/include/linux/kernel.h > >> @@ -1038,4 +1038,12 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } > >> /* OTHER_WRITABLE? Generally considered a bad idea. */ \ > >> BUILD_BUG_ON_ZERO((perms) & 2) + \ > >> (perms)) > >> + > >> +/* Flags for twisting kernel behavior. */ > >> +struct twist_flags { > >> + bool disable_kbd_k_spec_handler; > >> + bool disable_reboot_request; > >> +}; > >> +extern struct twist_flags twist_flags; > > > > > > Why all these options have to be in a single structure? > > There will be many options (maybe some dozens). > Do we really want to expose so many options individually? > > (If these options were build-time configuration, we won't need > this structure at all.) > > > > > > >> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > >> index 498d344ea53a..41cfabc74ad7 100644 > >> --- a/lib/Kconfig.debug > >> +++ b/lib/Kconfig.debug > >> @@ -2338,4 +2338,9 @@ config HYPERV_TESTING > >> > >> endmenu # "Kernel Testing and Coverage" > >> > >> +menuconfig DEFAULT_TWIST_FLAGS > >> + string "Default twist options (DANGEROUS)" > >> + help > >> + Don't specify anything unless you know what you are doing. > >> + > >> endmenu # Kernel hacking > > > > Why such a crazy build configure option? > > > > I think that the only way to get this upstream is to: > > > > + Add separate boot options that might theoretically be used also > > by other people. > > Like you said > > I am afraid that many of them could not be normal options. They change or > break some behavior that is necessary by seriously used system. > > these options are meant for helping fuzzers to find bugs while protecting > the kernel from legitimate-but-stupid requests from fuzzers. Other people > can include projects other than syzbot, but basically only useful for > debugging projects. (And making these options boot-time configuration > increases garbage/overhead for non-debugging usage.) There were suggestions that some switches might be useful in general. You should start with them. Anyway, it still sounds to me like another lockdown mode. I think that the relation with lockdown has already been discussed. But I do not remember if it was refused. > > + Use boot parameters and not build configuration. > > That sounds like a very tight restriction for syzbot. Relying on external > files breaks reproducibility; people can fail to specify intended options. > Saving intended options into the .config file is the most robust/reliable > approach. IMHO, it is not strict restriction. The motivation behind the boot options is: + Create widely useful behavior switches when possible instead of crazy hacks all over the kernel code. + The changes will modify the existing behavior. Build configuration works only when the kernel will be used for well defined purpose. Boot option is better for (distribution) kernels that are used by many different users. The person that builds the kernel does not know what behavior would different users prefer. You might argue that syzbot is a well defined user. But this goes back to the first motivation to created general purpose options when possible. > > + Avoid the meaningless word "twist" !!! > > Then, what do you suggest? I think that we need some keyword for grouping. > https://lkml.kernel.org/r/41a49d42-7119-62b9-085b-aa99cadc4dd1@i-love.sakura.ne.jp Please, start will single option and you will see how they are acceptable for the affected subsystem. You could always group them later. Anyway, the word "twist" is meaning less. It inspires people to create hacks that have undefined effects. IMHO, lockdown would be better but it is already used. Anyway, I suggest start with independent options for the begining. Best Regards, Petr PS: This is most likely my last reply in this thread. I feel that I am just repeating all the already mentioned ideas just by other words.