From patchwork Fri Jun 2 10:07:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados X-Patchwork-Id: 13264999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46210C7EE29 for ; Fri, 2 Jun 2023 10:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234953AbjFBKIP (ORCPT ); Fri, 2 Jun 2023 06:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234137AbjFBKIN (ORCPT ); Fri, 2 Jun 2023 06:08:13 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797A9132 for ; Fri, 2 Jun 2023 03:08:11 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230602100809euoutp012dda6eceba6bde962dab67e476dd3fc3~kz6oGUBrT0248402484euoutp01R for ; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230602100809euoutp012dda6eceba6bde962dab67e476dd3fc3~kz6oGUBrT0248402484euoutp01R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685700489; bh=YMh8Ybc8ZUhmFobAF8M2OSS9v8d0UX2pSUgXc6DqSNY=; h=From:To:CC:Subject:Date:References:From; b=FpZ2uz9p7xrKGDBdWYA84As+YaBBdVQj+LlfIX53ZlrKEgCCZrOK65ABxTBqm0TV6 d1eRzdvA+x7Tf9mmZw8qHKSbqhrTqPqY1/kd2xm8GbAjF3rFLVaTCNe2GCBdm7kTze LtDnqpgkC4aHQbjqlgfI5Z89vVH26z73SMcm5m6w= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230602100809eucas1p204242a767a6ae83c3e61eb9ae3ba99eb~kz6oAp1oC0507505075eucas1p2U; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AE.25.37758.98FB9746; Fri, 2 Jun 2023 11:08:09 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c~kz6nt6e6D1573015730eucas1p2w; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230602100809eusmtrp1765fdb334f9cc2a9e47219413270d330~kz6ntbXBx1803818038eusmtrp1F; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-2d-6479bf898be1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 29.34.14344.98FB9746; Fri, 2 Jun 2023 11:08:09 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230602100809eusmtip286e1106ead142a78db2efe8dde0e6c6b~kz6nfJWms0046600466eusmtip2L; Fri, 2 Jun 2023 10:08:09 +0000 (GMT) Received: from localhost (106.210.248.205) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 2 Jun 2023 11:08:08 +0100 From: Joel Granados To: CC: , , , Joel Granados Subject: [PATCH 0/8] Remove child from struct ctl_table Date: Fri, 2 Jun 2023 12:07:57 +0200 Message-ID: <20230602100805.777917-1-j.granados@samsung.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Originating-IP: [106.210.248.205] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCIsWRmVeSWpSXmKPExsWy7djP87qd+ytTDHpWKljs2XuSxeLyrjls FtPvvGezuDHhKaMDi8emVZ1sHp83yQUwRXHZpKTmZJalFunbJXBlHDuznL1gqVDFnSWH2BoY Z/F1MXJySAiYSOy+8YO9i5GLQ0hgBaNE/7otjBDOF0aJHS23mSGcz4wSTbdOs8O0PGrewAZi CwksZ5T4clcZrqht+Qyo9i2MEhv+TGMFqWIT0JE4/+YOM4gtIiAuceL0ZkYQm1lgAqPErEMc ILawgLnE88t7WLoYOThYBFQk1k6MAAnzCthIXFncwwSxWF6i7fp0Roi4oMTJmU9YIMbISzRv nc0MYUtIHHzxghmiXlliwrrfrBB2rcSpLbeYQG6TEFjJIXHzYg8byC4JAReJCYvUIGqEJV4d 3wL1pIzE6ck9LBD1kxkl9v/7wA7hrGaUWNb4Feoia4mWK0/YIQY5SrxaIgRh8knceCsIcQ+f xKRt05khwrwSHW1CEI1qEqvvvWGZwKg8C8k3s5B8MwvJNwsYmVcxiqeWFuempxYb56WW6xUn 5haX5qXrJefnbmIEJozT/45/3cG44tVHvUOMTByMhxglOJiVRHiFwspThHhTEiurUovy44tK c1KLDzFKc7AoifNq255MFhJITyxJzU5NLUgtgskycXBKNTBtd/kx9YzIV6Hzlw59ZJ+UMeOP Y7HX69VmVtv2HuzYKP1+X/3no58EnEqtYm5Y2cjK+8S0LZ9yV4C77q07f7n8WY51nBuiT/VF 8oeK93HuaJq8IqRy64EPXl8Vvu1vKuN89Dj4fOZZ15ali5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rU+wFD/eNeHWv/CFT7LLr5dkft6tsMlSlann82LnWdxf9gTX3Frx5fX7RrMp/celnpYt bfqUaPN2S+eD7ufrxcQYhf0KOPL+uSQI7dWYaTohj7NPelPzbveXq7xXfMk5dnLqLN0tfOmn uN+LunLHz/2VU/l+F6dl98lOo4MHXGI3icdeXarEUpyRaKjFXFScCABFnWLEGQMAAA== X-CMS-MailID: 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c X-Msg-Generator: CA X-RootMTR: 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230602100809eucas1p2c8bb96fb0de40a0f38ab28611246f95c References: Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This is part of the effort to remove the empty element of the ctl_table structures (used to calculate size) and replace it with an ARRAY_SIZE call. By replacing the child element in struct ctl_table with a flags element we make sure that there are no forward recursions on child nodes and therefore set ourselves up for just using an ARRAY_SIZE. We also added some self tests to make sure that we do not break anything. Patchset is separated in 4: parport fixes, selftests fixes, selftests additions and replacement of child element. Tested everything with sysctl self tests and everything seems "ok". 1. parport fixes: @mcgrof: this is related to my previous series and it plugs a sysct table leak in the parport driver. Please tell me if you want me to repost the parport series with this one stiched in. 2. Selftests fixes: Remove the prefixed zeros when passing a awk field to the awk print command because it was causing $0009 to be interpreted as $0. Replaced continue with return in sysctl.sh(test_case) so the test actually gets skipped. The skip decision is now in sysctl.sh(skip_test). 3. Selftest additions: New test to confirm that unregister actually removes targets. New test to confirm that permanently empty targets are indeed created and that no other targets can be created "on top". 4. Replaced the child pointer in struct ctl_table with a u8 flag. The flag is used to differentiate between permanently empty targets and non-empty ones. Comments/feedback greatly appreciated Best Joel Joel Granados (8): parport: plug a sysctl register leak test_sysctl: Fix test metadata getters test_sysctl: Group node sysctl test under one func test_sysctl: Add an unregister sysctl test test_sysctl: Add an option to prevent test skip test_sysclt: Test for registering a mount point sysctl: Remove debugging dump_stack sysctl: replace child with a flags var drivers/parport/procfs.c | 23 ++--- fs/proc/proc_sysctl.c | 82 ++++------------ include/linux/sysctl.h | 4 +- lib/test_sysctl.c | 91 ++++++++++++++++-- tools/testing/selftests/sysctl/sysctl.sh | 115 +++++++++++++++++------ 5 files changed, 204 insertions(+), 111 deletions(-)