Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1334906pxb; Fri, 13 Nov 2020 09:58:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwME5JxItfMWmySwwxuekgPlOX4uGXfgN/nkIWyzbJBKPBtFidoD2ni+ROS+M7a9Ilq1CaN X-Received: by 2002:a05:6402:22c6:: with SMTP id dm6mr3747025edb.139.1605290280682; Fri, 13 Nov 2020 09:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605290280; cv=none; d=google.com; s=arc-20160816; b=tgtz4zzc+xde8LIozLU8QdYomqR21Cdf1OoTSAnGVgrQELs/1nNgmbXkU+4eZY6pDQ KC9N8TVxMhsRDF4PDrbomqwRCrtCFpswa0Qtj1Klp051Db5DLMrjEOeu2x2bSDrK2Fib p/6RikZPz7ziXhf2r9dWIX28qeLfZZYlMEYDYxhLRclo9oXvaXBgT/1gU1rWv2hukPvj /ELVBnUkYkaNfpe9BrVye89VSZtjH/L6pj0gJT91IAncRIyaj6oZ8qiicQztTi//1Jzl OwpCMhQ7+qdgBChvCgEWruLwgEr8Jwrkehvsey+hey0NwzYfGiGv4ywbzJWoFb9ofRUp +mxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/+PMzrqEXwIpHSYqiZIonnkK0eqVZnv5ws8C/JpM2Ro=; b=ZDUwHReKl+yty3gkQZBU59YETO8XgUeejCJOqRfoyc7CBkitJObEXqbTaBvfDO9qbw TNGh3lQB6TrrEsoUcuy+AZntVMjTO8OVCnY6wzWHkHuSs2PPQ/V08ahgWrbnf/70BlrH SbQc41hTmuWnR8pVQa6F8m+xs7gO++8OkVu4J5P1WnmZcsnImA13Kqi2m3ImKEW0EWh1 cyUuF1+SCg1vdvJAhC9JysOQfU05HJ+X72p8VP2XZiAiFk82cc/rZ/goZSEhzCCeX79M aA1esen2Kadl8yxkMO1frAAo5bCPTQo58oM1SKTqZd03SYRBLcQbXSnE/lgFY05sTWbR Nxow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FE1+mMH0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si6057109ejc.46.2020.11.13.09.57.36; Fri, 13 Nov 2020 09:58:00 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=FE1+mMH0; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726174AbgKMRzU (ORCPT + 99 others); Fri, 13 Nov 2020 12:55:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbgKMRzT (ORCPT ); Fri, 13 Nov 2020 12:55:19 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3937C0613D1 for ; Fri, 13 Nov 2020 09:55:17 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id o15so10868137wru.6 for ; Fri, 13 Nov 2020 09:55:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/+PMzrqEXwIpHSYqiZIonnkK0eqVZnv5ws8C/JpM2Ro=; b=FE1+mMH0UYMQRcQQs7KpXFA4j/4+C7+LWdthCcraI4GjvHoVSq5egSXJ6dIWT52Tb/ VZbrsdVzeK7nkCczjAWhm1H4Rs3HIouuOPKj119ajegykHfj7CUteydCStxrj5x0hlnH XBDM6HOeJ8jwSjZEujY/i83583kf7woW21nDuLJmd6Epr58dbZeqVHYAkTmaAMgrJ/RM eBW4eIJ91niVQFmmNXKF7hfKI9w+QGuPppUGZ1Yr7Atxmji3ZgrN0xT7N1i1zsqbi6FY mQEzwScKiSGV5hZDxk0wTMrdRZg9UyCKaj0ThbUezV0lN9IMsEX9k9DCpqaAQlpiY3Vr 13ow== 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=/+PMzrqEXwIpHSYqiZIonnkK0eqVZnv5ws8C/JpM2Ro=; b=c3Oyg7PvFT2/XV8tmFKfJVV1cNx0D9xsc/2BQIY0l3suLxAviVsbL+1poaKEb8AQDi ILOtzXyFZL1VcbKgVnt/2/XwNDI1/w7VsKPQaRN+cEWhvMxOa2hfqLzXZwQ1N4+HzbSi FJ3H8yJnvXOdxu6L2OKCITR+114Jiilso0HaKPZdsYrJhzL2dn0dbF+SrQW+yzDLt2TU 8jhnl2cRAr8GBhOgp8WO1tYe/uzrcjVV8IJXgdBuSMKr913mM3PpGKYeLqsz7tNkekL8 94vQCCr3wTcgWTZEWyfKpdH0Oo55EfbtDtAGjLc4n/U8bMIIydct61WGDerpuO/F4xJh UPSQ== X-Gm-Message-State: AOAM533Xdpp4cBCy+JKy+wYJg313H/DUAXvjH95VkCHL44kdGRJwPw5a Va1knnBkZF75jkAN48GWS0K7CQ== X-Received: by 2002:adf:e607:: with SMTP id p7mr4796819wrm.93.1605290115315; Fri, 13 Nov 2020 09:55:15 -0800 (PST) Received: from elver.google.com ([2a00:79e0:15:13:f693:9fff:fef4:2449]) by smtp.gmail.com with ESMTPSA id c185sm11477158wma.44.2020.11.13.09.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 09:55:14 -0800 (PST) Date: Fri, 13 Nov 2020 18:55:08 +0100 From: Marco Elver To: Andrey Konovalov Cc: Dmitry Vyukov , Alexander Potapenko , Catalin Marinas , Will Deacon , Vincenzo Frascino , Evgenii Stepanov , Andrey Ryabinin , Branislav Rankov , Kevin Brodsky , Andrew Morton , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 11/20] kasan: add and integrate kasan boot parameters Message-ID: <20201113175508.GB3175464@elver.google.com> References: <20201113175254.GA3175464@elver.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113175254.GA3175464@elver.google.com> User-Agent: Mutt/1.14.6 (2020-07-11) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 06:52PM +0100, Marco Elver wrote: > On Tue, Nov 10, 2020 at 11:20PM +0100, 'Andrey Konovalov' via kasan-dev wrote: > [...] > > +/* kasan.mode=off/prod/full */ > > +static int __init early_kasan_mode(char *arg) > > +{ > > + if (!arg) > > + return -EINVAL; > > + > > + if (!strcmp(arg, "off")) > > + kasan_arg_mode = KASAN_ARG_MODE_OFF; > > + else if (!strcmp(arg, "prod")) > > + kasan_arg_mode = KASAN_ARG_MODE_PROD; > > + else if (!strcmp(arg, "full")) > > + kasan_arg_mode = KASAN_ARG_MODE_FULL; > > + else > > + return -EINVAL; > > + > > + return 0; > > +} > > +early_param("kasan.mode", early_kasan_mode); > > + > > +/* kasan.stack=off/on */ > > +static int __init early_kasan_flag_stacktrace(char *arg) > > +{ > > + if (!arg) > > + return -EINVAL; > > + > > + if (!strcmp(arg, "off")) > > + kasan_arg_stacktrace = KASAN_ARG_STACKTRACE_OFF; > > + else if (!strcmp(arg, "on")) > > + kasan_arg_stacktrace = KASAN_ARG_STACKTRACE_ON; > > + else > > + return -EINVAL; > > + > > + return 0; > > +} > > +early_param("kasan.stacktrace", early_kasan_flag_stacktrace); > > + > > +/* kasan.fault=report/panic */ > > +static int __init early_kasan_fault(char *arg) > > +{ > > + if (!arg) > > + return -EINVAL; > > + > > + if (!strcmp(arg, "report")) > > + kasan_arg_fault = KASAN_ARG_FAULT_REPORT; > > + else if (!strcmp(arg, "panic")) > > + kasan_arg_fault = KASAN_ARG_FAULT_PANIC; > > + else > > + return -EINVAL; > > + > > + return 0; > > +} > [...] > > The above could be simplified, see suggestion below. > > Thanks, > -- Marco > > ------ >8 ------ > > diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c > index c91f2c06ecb5..71fc481ad21d 100644 > --- a/mm/kasan/hw_tags.c > +++ b/mm/kasan/hw_tags.c > @@ -64,10 +64,8 @@ static int __init early_kasan_mode(char *arg) > kasan_arg_mode = KASAN_ARG_MODE_PROD; > else if (!strcmp(arg, "full")) > kasan_arg_mode = KASAN_ARG_MODE_FULL; > - else > - return -EINVAL; > > - return 0; > + return -EINVAL; Ah that clearly doesn't work. Hmm, never mind this suggestion, sorry. Thanks, -- Marco