Received: by 10.213.65.68 with SMTP id h4csp285529imn; Mon, 12 Mar 2018 13:49:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELuZ+TEm05xhqEAGw/I2HkB3oZ3jIArWi2MHDoU9WmXZ0AxAICyE36p1nQtxfwjfZa9zdDyE X-Received: by 2002:a17:902:7885:: with SMTP id q5-v6mr9270943pll.207.1520887768301; Mon, 12 Mar 2018 13:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520887768; cv=none; d=google.com; s=arc-20160816; b=gmyi1YVEnbFQLhVa7dzDTL8azi76X+PbF06q44QxNCNnX1CQ4ZN2n049CUEu5lwMXt N5WmxlV5C/HML4KHDgwXnZrS+cohTvFBKoUQ5lOl+NteFAuXPrkvL75Vdn8S2ZaK+CIY hndx5GMmvQVzDSsw9D22DPfPT/LX69g2oC7BwIUSTzINxWYaPgDBLNp75h6RNf6D2yr2 xOF8YQLUcpHAXo7xTDwCuTnzAJq7gcfS9527XNPQfQQX+ZgiHGMkzfYI8AfM9obpHoIV N78eKg+Q3e0/9cwpZOhun/O1usiWf46p6btCv58YT2D5FikbqgM2z9KXlKOMnaGNO6ee ibzQ== 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=83JABSKKiTNhvqThAWw+go5HHP1fmpse02+kfWHAuxs=; b=oWBQv3oGttGShbGy47st1qUADpvFQIKDqEjf3/pkWR+AcltAQ+2OLwpWRTggXAL7H8 R8JqRpKpUlkmZFYtJDiEXcG5Qdov0rLJJsQtoiOEswKvmic46S+wOhPIOqidiVkQw1F0 rbk86VS3rRIlLqqUSaSAy0mHe+7NkieuP9iCqiH3B40mJic7vhuAoBhCmSUcLfHudDP7 RdYxaL8dp5XPqjyvH2uyqaaZlwAEQp+TaPfqY5ymXu534JpNGil0i7vInX9N6dCMAbAk wCTIBhZQPQgWhYMyWNDXaP0GjxYNlgSJeZG3B8CbIPyCw/x9QkjEGGPNzOogw6oAkrF6 LvSA== 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 e3-v6si2977998pls.530.2018.03.12.13.49.13; Mon, 12 Mar 2018 13:49: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; 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 S932342AbeCLUsK (ORCPT + 99 others); Mon, 12 Mar 2018 16:48:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57112 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932171AbeCLUsI (ORCPT ); Mon, 12 Mar 2018 16:48:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32BF9406E8B9; Mon, 12 Mar 2018 20:48:08 +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 EE9A1218CC0F; Mon, 12 Mar 2018 20:48:07 +0000 (UTC) Subject: Re: [PATCH v4 1/6] sysctl: Add flags to support min/max range clamping 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-2-git-send-email-longman@redhat.com> <20180312204413.GY4449@wotan.suse.de> From: Waiman Long Organization: Red Hat Message-ID: <53093737-776f-d455-5651-3a57d5ac7be9@redhat.com> Date: Mon, 12 Mar 2018 16:48:07 -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: <20180312204413.GY4449@wotan.suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 20:48:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Mar 2018 20:48:08 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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:44 PM, Luis R. Rodriguez wrote: > On Mon, Mar 12, 2018 at 04:15:39PM -0400, Waiman Long wrote: >> When minimum/maximum values are specified for a sysctl parameter in >> the ctl_table structure with proc_dointvec_minmax() handler, update >> to that parameter will fail with error if the given value is outside >> of the required range. >> >> There are use cases where it may be better to clamp the value of >> the sysctl parameter to the given range without failing the update, >> especially if the users are not aware of the actual range limits. >> Reading the value back after the update will now be a good practice >> to see if the provided value exceeds the range limits. >> >> To provide this less restrictive form of range checking, a new flags >> field is added to the ctl_table structure. >> >> When the CTL_FLAGS_CLAMP_RANGE flag is set in the ctl_table >> entry, any update from the userspace will be clamped to the given >> range without error if either the proc_dointvec_minmax() or the >> proc_douintvec_minmax() handlers is used. > You keep missing to document both on commit log and kdoc which > end on the range is selected if you happen to go over. To be clear > it is unclear from reading the commit log if a default is set if > you go over if you pick another value. In this case it is conditional > if you go over we pick the high range max, and if you go below the > lower range minimum set allowed. > > What happens if no low range is set and that is what the issue in > terms of range triggers? Sorry for missing that. If a minimum value is not specified, no minimum checking and clamping will be done. Similarly for maximum. I will clarify that. Cheers, Longman