Received: by 10.213.65.68 with SMTP id h4csp295151imn; Mon, 12 Mar 2018 14:09:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELti4iMsD9akwyKmXIrQQdJ0J47rFshPeo/kJOOCF9VhbNERwvO9iAd6BMTZAaa6FtYVRuT5 X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr9488722plb.203.1520888956881; Mon, 12 Mar 2018 14:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520888956; cv=none; d=google.com; s=arc-20160816; b=ZgAA+xEwcQtZoIB+Z5mpxqs9npubaBeWp93sO28cn9/ZeVbDx7YYRe+TQUFp33Jil/ g0doTguor70BRfF0U1LfDYvigZXq8hxc/G7jU3zdSlSArvf5jf00TYgbeNdY/BYbZb5A wbmEG7m90QXIInXFML8/RB87XeuTpCPaNHqHtKbuLoE8E5uv1SDW0kQZomx1MOPNbEFS SKKG7fdTveK5Ie7fY0Mu9OmLgGJtx1GBFR3SaFztBMcm8Z6/d6KYg7jBkXNXgm6yAKJ/ NKVVqv//ygdOSXdYsWiwp7/52v64Yh5f8XCdFW90v/sC/A2EGBAZ2PaNp+BoW0Kv+0fw mQpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=134IL/XqDoGJSA4WWTqBZT6LIv6PjLC+5ejswzzDsac=; b=UTIJuxWrjD0GhlGN5jDnSjueDWPymXmB88rlhNaHuatTKD4k8Gn0WF5+nVD9JrpUag zaxOWOcyyetTtEMJbfC1vB4kz/bpTALufaIfATfK74go9ooYghi0yF1Qzds86dpBXxnm aZrsaA2Hllx6va34C0kfBrKD8f/ch9+ctLhagoqQoHQeqeKbWZLGM3BECIW4qYec3/RC OMwVdj8/V3LR7SyDs7vH+q/evInumeKt5zlz/pa/jxJk20RR3PBHiOKTM0Q3x2wl6bYH 9YwDi3XWTMU3tlk9uYTHRhAK8IKSHE95RKmOG3bf4yuBh2izVOsIgHnAn7dECe7uQzmv 701g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si5560698pgn.696.2018.03.12.14.09.01; Mon, 12 Mar 2018 14:09:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932316AbeCLVHt (ORCPT + 99 others); Mon, 12 Mar 2018 17:07:49 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49352 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932215AbeCLVHr (ORCPT ); Mon, 12 Mar 2018 17:07:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 538E98182D2A; Mon, 12 Mar 2018 21:07:47 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-75.bos.redhat.com [10.18.17.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23D2C94585; Mon, 12 Mar 2018 21:07:47 +0000 (UTC) Subject: Re: [PATCH v4 3/6] sysctl: Warn when a clamped sysctl parameter is set out of range To: "Luis R. Rodriguez" Cc: Kees Cook , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Al Viro , Matthew Wilcox References: <1520885744-1546-1-git-send-email-longman@redhat.com> <1520885744-1546-4-git-send-email-longman@redhat.com> <20180312205001.GA4449@wotan.suse.de> From: Waiman Long Organization: Red Hat Message-ID: <0307d95f-8b2f-0cdc-913c-656a9f2dec7f@redhat.com> Date: Mon, 12 Mar 2018 17:07:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20180312205001.GA4449@wotan.suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Mar 2018 21:07:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 12 Mar 2018 21:07:47 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/12/2018 04:50 PM, Luis R. Rodriguez wrote: > On Mon, Mar 12, 2018 at 04:15:41PM -0400, Waiman Long wrote: >> Even with clamped sysctl parameters, it is still not that straight >> forward to figure out the exact range of those parameters. One may >> try to write extreme parameter values to see if they get clamped. >> To make it easier, a warning with the expected range will now be >> printed into the kernel ring buffer when a clamped sysctl parameter >> receives an out of range value. >> >> The pr_warn_ratelimited() macro is used to limit the number of warning >> messages that can be printed within a given period of time. >> >> Signed-off-by: Waiman Long >> --- >> kernel/sysctl.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- >> 1 file changed, 40 insertions(+), 8 deletions(-) >> >> diff --git a/kernel/sysctl.c b/kernel/sysctl.c >> index 3d65f41..14aca92 100644 >> --- a/kernel/sysctl.c >> +++ b/kernel/sysctl.c >> @@ -2505,6 +2505,7 @@ static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write, >> * @min: pointer to minimum allowable value >> * @max: pointer to maximum allowable value >> * @flags: pointer to flags >> + * @name: sysctl parameter name >> * >> * The do_proc_dointvec_minmax_conv_param structure provides the >> * minimum and maximum values for doing range checking for those sysctl >> @@ -2514,31 +2515,48 @@ struct do_proc_dointvec_minmax_conv_param { >> int *min; >> int *max; >> unsigned int *flags; >> + const char *name; >> }; >> >> +#ifdef pr_fmt >> +#undef pr_fmt >> +#endif >> +#define pr_fmt(fmt) "sysctl: " fmt > No. This needs to be defined at the top of the file, please look > at other uses on kernel/*.c and just use: > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > The filename already provides the name we want. Right. That is the right way to do it. Cheers, Longman