Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp793039imp; Thu, 21 Feb 2019 11:17:06 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia0wqUjte2hmHYSZnyKkE/rONqCcDcLPMerFE8bT3nRQMu6S2lkgPNweQrcWLJJnYceOOeb X-Received: by 2002:a63:584e:: with SMTP id i14mr129518pgm.68.1550776625969; Thu, 21 Feb 2019 11:17:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550776625; cv=none; d=google.com; s=arc-20160816; b=skjCqcfHP245m6g2EG1A6xfS8QNMixsvVh2KwGsDQYvlrK1rukjd93cMQkac0XvXaC Wgx64qwCjaJgTXYaxaBnjCw3smnZjkHuBUiFfNdtjmwP+Z0rPLnb3H7GwE5lKc7PC0ej OkajNUQ3NhcFemE7nR0XQo8Ml5GRl9DVJqK7nKcNmcylrsIpjw04GbL5YcvwCSqt/0BI /81MsWI4toqrAfUhS7MJBIfl+u8reOiqniWMlIxbPPgsei7Y2sO01zjYLmsU7JqE/uCn xjMx45+33TNSn+LPRmi4t2xkJTiVSdvEb8CoZVW84avuzOYjedPlfxpfUZcqqv5lZGhp QzcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=0AAHReDKVgGf8A1JrEBlxRtTio8gd/4VlkGjN6bo118=; b=Rh1n/Jh91VvflgwLUItFyjnEjOTQFx53hi4IendrbmD0a8Qk0+eSmsbYuoEqkQbXp2 wL5if21Cc8QK7CrFmVmAGZnX3/xXk8rSifD7AhC1QcDmlXJ5Wkx/M+kSxMc8J2nSnrrA O5eZVkWHvncRXKQ1wOCXotADFfwJoHzemQuEkWIBDfpitUMBUwBz/K5Kw6urpUL8z6Mn h8R7zADXPsb7vNAxHOdteBI42GPK5gzxE019he6c2YUiP3UiMFDcNJRebQrIfPEmAmcf 57OnAILkUwuILjeazlbZjnRTo0mBM333l8+Pdrbpb+y1s9IwsDm5Tx2b6r2BwUkXiqpG YIoQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g129si22011532pgc.593.2019.02.21.11.16.46; Thu, 21 Feb 2019 11:17:05 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbfBUTQY (ORCPT + 99 others); Thu, 21 Feb 2019 14:16:24 -0500 Received: from sandeen.net ([63.231.237.45]:34410 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbfBUTQY (ORCPT ); Thu, 21 Feb 2019 14:16:24 -0500 Received: from [10.0.0.4] (liberator [10.0.0.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sandeen.net (Postfix) with ESMTPSA id 2FA9687D; Thu, 21 Feb 2019 13:16:06 -0600 (CST) Subject: [PATCH V2] test_sysctl: add proc_do_large_bitmap test function To: Eric Sandeen , Linux Kernel Mailing List , fsdevel , netdev@vger.kernel.org Cc: Luis Chamberlain , Kees Cook References: <53be40fc-6ec4-c714-a64e-f69c96f7058f@redhat.com> <8166cf23-db52-7679-3378-8523889a9cd0@sandeen.net> From: Eric Sandeen Openpgp: preference=signencrypt Autocrypt: addr=sandeen@sandeen.net; prefer-encrypt=mutual; keydata= mQINBE6x99QB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sxN5etheLMO gRwWpLn6yNFq/xtgs+ECgG+gR78yXQyA7iCs5tFs2OrMqV5juSMGmn0kxJUAEQEAAYkCHwQY AQIACQUCTrH31AIbDAAKCRAgrhaS4T3e4BKwD/0ZOOmUNOZCSOLAMjZx3mtYtjYgfUNKi0ki YPveGoRWTqbis8UitPtNrG4XxgzLOijSdOEzQwkdOIp/QnZhGNssMejCnsluK0GQd+RkFVWN mcQT78hBeGcnEMAXZKq7bkIKzvc06GFmkMbX/gAl6DiNGv0UNAX+5FYh+ucCJZSyAp3sA+9/ LKjxnTedX0aygXA6rkpX0Y0FvN/9dfm47+LGq7WAqBOyYTU3E6/+Z72bZoG/cG7ANLxcPool LOrU43oqFnD8QwcN56y4VfFj3/jDF2MX3xu4v2OjglVjMEYHTCxP3mpxesGHuqOit/FR+mF0 MP9JGfj6x+bj/9JMBtCW1bY/aPeMdPGTJvXjGtOVYblGZrSjXRn5++Uuy36CvkcrjuziSDG+ JEexGxczWwN4mrOQWhMT5Jyb+18CO+CWxJfHaYXiLEW7dI1AynL4jjn4W0MSiXpWDUw+fsBO Pk6ah10C4+R1Jc7dyUsKksMfvvhRX1hTIXhth85H16706bneTayZBhlZ/hK18uqTX+s0onG/ m1F3vYvdlE4p2ts1mmixMF7KajN9/E5RQtiSArvKTbfsB6Two4MthIuLuf+M0mI4gPl9SPlf fWCYVPhaU9o83y1KFbD/+lh1pjP7bEu/YudBvz7F2Myjh4/9GUAijrCTNeDTDAgvIJDjXuLX pA== Message-ID: Date: Thu, 21 Feb 2019 13:16:22 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add test to build up bitmap range string and test the bitmap proc handler. Signed-off-by: Eric Sandeen --- V2: set rc=0 for test success however this still fails indeterminately for me. Debugging, if I save off the test write string and the read string, re-writing it to the handler works fine. My standalone test also works fine for 1000 iterations. So I don't know what's going on here. nb: test_modprobe & load_req_mod fail for me before we ever get to this test, but commenting them out, my test runs as expected. I'm new to this script, so careful review would be wise. Thanks, -Eric diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh index 584eb8ea780a..e531074f94bd 100755 --- a/tools/testing/selftests/sysctl/sysctl.sh +++ b/tools/testing/selftests/sysctl/sysctl.sh @@ -37,6 +37,7 @@ ALL_TESTS="$ALL_TESTS 0002:1:1" ALL_TESTS="$ALL_TESTS 0003:1:1" ALL_TESTS="$ALL_TESTS 0004:1:1" ALL_TESTS="$ALL_TESTS 0005:3:1" +ALL_TESTS="$ALL_TESTS 0006:3:1" test_modprobe() { @@ -149,6 +150,9 @@ reset_vals() string_0001) VAL="(none)" ;; + bitmap_0001) + VAL="" + ;; *) ;; esac @@ -548,6 +552,48 @@ run_stringtests() test_rc } +run_bitmaptest() { + # Total length of bitmaps string to use, a bit under + # the maximum input size of the test node + LENGTH=$((RANDOM % 65000)) + + # First bit to set + BIT=$((RANDOM % 1024)) + + # String containing our list of bits to set + TEST_STR=$BIT + + # build up the string + while [ "${#TEST_STR}" -le "$LENGTH" ]; do + # Make sure next entry is discontiguous, + # skip ahead at least 2 + BIT=$((BIT + $((2 + RANDOM % 10)))) + + # Add new bit to the list + TEST_STR="${TEST_STR},${BIT}" + + # Randomly make it a range + if [ "$((RANDOM % 2))" -eq "1" ]; then + RANGE_END=$((BIT + $((1 + RANDOM % 10)))) + TEST_STR="${TEST_STR}-${RANGE_END}" + BIT=$RANGE_END + fi + done + + echo -n "Checking bitmap handler... " + echo $TEST_STR > /tmp/test_str + echo -n $TEST_STR > $TARGET 2> /dev/null + + if verify "${TARGET}"; then + echo "FAIL" >&2 + rc=1 + else + echo "ok" + rc=0 + fi + test_rc +} + sysctl_test_0001() { TARGET="${SYSCTL}/int_0001" @@ -605,6 +651,14 @@ sysctl_test_0005() run_limit_digit_int_array } +sysctl_test_0006() +{ + TARGET="${SYSCTL}/bitmap_0001" + reset_vals + ORIG="" + run_bitmaptest +} + list_tests() { echo "Test ID list:" @@ -618,6 +672,7 @@ list_tests() echo "0003 x $(get_test_count 0003) - tests proc_dointvec()" echo "0004 x $(get_test_count 0004) - tests proc_douintvec()" echo "0005 x $(get_test_count 0005) - tests proc_douintvec() array" + echo "0006 x $(get_test_count 0006) - tests proc_do_large_bitmap" } test_reqs