From nobody Fri Dec 19 14:24:09 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 339CF524BC for ; Mon, 19 Feb 2024 20:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374445; cv=none; b=IOokB9Rio2sGD/S2cm4kksz2ryidbWK5LpADMswTokgS+ld3mNeyUHSwzgQV7tDzKCwApxd/7vlokkTcz1LrdCmfNeORiZCkreGIRiRGytiOtpPnJgo34tUftLV8jnxZBOW90kYTz4H26ydExY0PO9wIt6hWbfAN2FbbAVH0Aos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374445; c=relaxed/simple; bh=uNI9A4+TJF5i7pPxyp9+QkZo2T/8fL0GY2fuRb0TubU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ldnkmC9S1gaEKg8hFZ/zz5WjZ0QLb2FZVwMZa2VQn40xW9bIA5Z7/Jz9YyxpUyhloXbmEEnqh+AvetfM0Ul7q/dYylCfOw7CxD+kwkKCV0bAOyFZNkYJn3E6SrGQxZuiHOIB86YwrOz1IQngTpOGaOzE7opV8xmfSXodt/iL+Hk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=ZxL5maTc; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="ZxL5maTc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1708373975; bh=uNI9A4+TJF5i7pPxyp9+QkZo2T/8fL0GY2fuRb0TubU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZxL5maTcxrrgWQKt1rczLFI4gK0avOX0UAcNV9L3twfJBzn/+9imqIwY0+ISrOr2S 6B3rVjOlXlH5TOJTv+RvzEhXzqwTPjKjXodVctaHHCvRDOR5aT3Nde0FNpuq1AM+RF /lu2zJl9hzTDIAQcp5dw1DEH1uYQ4E7yUfJaxaOM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 19 Feb 2024 21:19:22 +0100 Subject: [PATCH v3 1/3] scripts: check-sysctl-docs: adapt to new API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240219-sysctl-check-v3-1-6940d5ff747b@weissschuh.net> References: <20240219-sysctl-check-v3-0-6940d5ff747b@weissschuh.net> In-Reply-To: <20240219-sysctl-check-v3-0-6940d5ff747b@weissschuh.net> To: Luis Chamberlain , Joel Granados Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708373973; l=3441; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=uNI9A4+TJF5i7pPxyp9+QkZo2T/8fL0GY2fuRb0TubU=; b=pkAhhEiUYGBNfr4QbfStCKcV4IhzZw3S2XloiuS1+C2X6eMcatL3JlLcIk2uEmexPuzowZYDt LE0H4okIbr3Be3L+JSgBFjgZCW0myUgHP85ppoob5ZqgTxhjixRDvBp X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The script expects the old sysctl_register_paths() API which was removed some time ago. Adapt it to work with the new sysctl_register()/sysctl_register_sz()/sysctl_register_init() APIs. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Joel Granados --- scripts/check-sysctl-docs | 45 ++++++++++++-------------------------------= -- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/scripts/check-sysctl-docs b/scripts/check-sysctl-docs index 4f163e0bf6a4..739afd766708 100755 --- a/scripts/check-sysctl-docs +++ b/scripts/check-sysctl-docs @@ -8,7 +8,7 @@ # Example invocation: # scripts/check-sysctl-docs -vtable=3D"kernel" \ # Documentation/admin-guide/sysctl/kernel.rst \ -# $(git grep -l register_sysctl_) +# $(git grep -l register_sysctl) # # Specify -vdebug=3D1 to see debugging information =20 @@ -20,14 +20,10 @@ BEGIN { } =20 # The following globals are used: -# children: maps ctl_table names and procnames to child ctl_table names # documented: maps documented entries (each key is an entry) # entries: maps ctl_table names and procnames to counts (so # enumerating the subkeys for a given ctl_table lists its # procnames) -# files: maps procnames to source file names -# paths: maps ctl_path names to paths -# curpath: the name of the current ctl_path struct # curtable: the name of the current ctl_table struct # curentry: the name of the current proc entry (procname when parsing # a ctl_table, constructed path when parsing a ctl_path) @@ -94,44 +90,23 @@ FNR =3D=3D NR { =20 # Stage 2: process each file and find all sysctl tables BEGINFILE { - delete children delete entries - delete paths - curpath =3D "" curtable =3D "" curentry =3D "" if (debug) print "Processing file " FILENAME } =20 -/^static struct ctl_path/ { - match($0, /static struct ctl_path ([^][]+)/, tables) - curpath =3D tables[1] - if (debug) print "Processing path " curpath -} - -/^static struct ctl_table/ { - match($0, /static struct ctl_table ([^][]+)/, tables) - curtable =3D tables[1] +/^static( const)? struct ctl_table/ { + match($0, /static( const)? struct ctl_table ([^][]+)/, tables) + curtable =3D tables[2] if (debug) print "Processing table " curtable } =20 /^};$/ { - curpath =3D "" curtable =3D "" curentry =3D "" } =20 -curpath && /\.procname[\t ]*=3D[\t ]*".+"/ { - match($0, /.procname[\t ]*=3D[\t ]*"([^"]+)"/, names) - if (curentry) { - curentry =3D curentry "/" names[1] - } else { - curentry =3D names[1] - } - if (debug) print "Setting path " curpath " to " curentry - paths[curpath] =3D curentry -} - curtable && /\.procname[\t ]*=3D[\t ]*".+"/ { match($0, /.procname[\t ]*=3D[\t ]*"([^"]+)"/, names) curentry =3D names[1] @@ -140,10 +115,14 @@ curtable && /\.procname[\t ]*=3D[\t ]*".+"/ { file[curentry] =3D FILENAME } =20 -/\.child[\t ]*=3D/ { - child =3D trimpunct($NF) - if (debug) print "Linking child " child " to table " curtable " entry = " curentry - children[curtable][curentry] =3D child +/register_sysctl.*/ { + match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, table= s) + if (debug) print "Registering table " tables[3] " at " tables[2] + if (tables[2] =3D=3D table) { + for (entry in entries[tables[3]]) { + printentry(entry) + } + } } =20 END { --=20 2.43.2 From nobody Fri Dec 19 14:24:09 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 339563D38C for ; Mon, 19 Feb 2024 20:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374445; cv=none; b=ItIZgHug2xVZBEfJB+zvtlw/Yr5m0XsHymRHfaJVId984miSrGs3aTZRaoOjyjsdWdSrte6g53IXxwn0IVuG85N4IGb8HBjK9oXnpxp/feYueNPwANTbbZKBcq7OpIKVQ4ry//URYNl6D8ey6Cwj/2KF9AfKZ4Q3T8OpaA05Q2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374445; c=relaxed/simple; bh=2+aoCwOd06/v1RwfWjtXRvkTzvzg3Gip4JPINzS5zGw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C5zKRaONF1q0812ogaVUp5v29rsXv1U82sOHLE8byfOwGi8rlK9rJOQvQP+K4B80+Emc7CO9ToJpUTzjctHFInFxSoxfBxuqRODsNA9kkqHWoSvpIQVjR+vicD/sTluN8gOLy2qXPCP6zAabel0NA738AY5apSN3wMAK5swAvvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=Nn6oRj52; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="Nn6oRj52" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1708373975; bh=2+aoCwOd06/v1RwfWjtXRvkTzvzg3Gip4JPINzS5zGw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Nn6oRj52uOevfeinneNNvv6zz5iNu4l5SM6k0SPBlWNKzB+XAtRQbp2qom68SVsmc +Ld3fukJ0WuH9QLVzXYl+DCatXDgPKScmW59/5xWJOkwXc0HOUdopR5Pt2Je1YvUx9 Vl25Uu+s81Wph/veKdYwujymErvsj21BzWOU+Tu4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 19 Feb 2024 21:19:23 +0100 Subject: [PATCH v3 2/3] ipc: remove linebreaks from arguments of __register_sysctl_table Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240219-sysctl-check-v3-2-6940d5ff747b@weissschuh.net> References: <20240219-sysctl-check-v3-0-6940d5ff747b@weissschuh.net> In-Reply-To: <20240219-sysctl-check-v3-0-6940d5ff747b@weissschuh.net> To: Luis Chamberlain , Joel Granados Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708373973; l=797; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2+aoCwOd06/v1RwfWjtXRvkTzvzg3Gip4JPINzS5zGw=; b=4a1lYJ1PBMTeJ+6XFqt0TOA2ayoWIl3GQxZ8fy2AU3RjjsgobW0N8db4rYq9EkMvbSHXaa8/w IIHgKKGd4BLAjxli2DumdMyGGqqf89gO1OGf+heF13ZUPDvVx3mto5p X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Calls to __register_sysctl_table will be validated by scripts/check-sysctl-docs. As this script is line-based remove the linebreak which would confuse the script. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Joel Granados --- ipc/ipc_sysctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c index 8c62e443f78b..e4008288a3ba 100644 --- a/ipc/ipc_sysctl.c +++ b/ipc/ipc_sysctl.c @@ -259,8 +259,7 @@ bool setup_ipc_sysctls(struct ipc_namespace *ns) tbl[i].data =3D NULL; } =20 - ns->ipc_sysctls =3D __register_sysctl_table(&ns->ipc_set, - "kernel", tbl, + ns->ipc_sysctls =3D __register_sysctl_table(&ns->ipc_set, "kernel", tbl, ARRAY_SIZE(ipc_sysctls)); } if (!ns->ipc_sysctls) { --=20 2.43.2 From nobody Fri Dec 19 14:24:09 2025 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3399E51037 for ; Mon, 19 Feb 2024 20:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374445; cv=none; b=KuxqjgI+jIuS09C5zuumMfrWHjRDCS8ji31rXzhK9avAmf1HeKfPtbX5/h9Gf7Ad3pU5FpjMXom7baji3Ci+l9HUo9Aw81rup50Ju4q1HY2GdEEwlxbfqR5miRxfUl74ULGzFItvt/HdeWxlNethqzE7nKSYf07/SlmthJEezXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708374445; c=relaxed/simple; bh=EA5jBFUYpIY/y4RMC8tQE5p9Mv3S3wcaYM7/mxK/iFY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ot5zDQLprkV9VOnno6bhNjQ6Xov6DVKvIbCqdqUWsZvqY8bezukWr4MyNXqZ1GqoNmLhyVCJQwMSa2qr2frU+8czcHWKpdhVi31Dry8IrBH5+EwqSsFY2y99ydSQQ1BlOo9cBbM/DUAiLfFUPNDVF+gYrSC1ZGzuxmz65dS3gTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=sWS1Ua1F; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="sWS1Ua1F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1708373975; bh=EA5jBFUYpIY/y4RMC8tQE5p9Mv3S3wcaYM7/mxK/iFY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sWS1Ua1F1EpI89I8bH9VwCpXymaYW4QZKGvh29/bHpv2aoUukVXZ16fbpBGD1Pblr 53ytfLuiV1AUOVT3wFuV5Mjg8slJbqQ5u97+OGgqFSB6T/F+YDcjymRjogKjF/+kw6 yrm5THllBEwE72fshIHfOuFLk1FNtJO+hVvrKyrQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 19 Feb 2024 21:19:24 +0100 Subject: [PATCH v3 3/3] scripts: check-sysctl-docs: handle per-namespace sysctls Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240219-sysctl-check-v3-3-6940d5ff747b@weissschuh.net> References: <20240219-sysctl-check-v3-0-6940d5ff747b@weissschuh.net> In-Reply-To: <20240219-sysctl-check-v3-0-6940d5ff747b@weissschuh.net> To: Luis Chamberlain , Joel Granados Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708373973; l=1552; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=EA5jBFUYpIY/y4RMC8tQE5p9Mv3S3wcaYM7/mxK/iFY=; b=eqXM5vpp2Z6p7wWyuD0lxi8xux1yT5tWJwNIXFitZlx8OW+WZmaowTUkFYiMKUtjEWW5ew8J5 qMQ3BLPJheaDvJTE53ulheeOYVZpBA6XGvKeHtWsyr/CnNI+RhMKuxb X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Some sysctl tables are registered for each namespace. (Like in ipc/ipc_sysctl.c) These need special handling to track the variable assignments. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Joel Granados --- scripts/check-sysctl-docs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/check-sysctl-docs b/scripts/check-sysctl-docs index 739afd766708..20274c63e745 100755 --- a/scripts/check-sysctl-docs +++ b/scripts/check-sysctl-docs @@ -93,6 +93,7 @@ BEGINFILE { delete entries curtable =3D "" curentry =3D "" + delete vars if (debug) print "Processing file " FILENAME } =20 @@ -105,6 +106,7 @@ BEGINFILE { /^};$/ { curtable =3D "" curentry =3D "" + delete vars } =20 curtable && /\.procname[\t ]*=3D[\t ]*".+"/ { @@ -125,6 +127,24 @@ curtable && /\.procname[\t ]*=3D[\t ]*".+"/ { } } =20 +/kmemdup.*/ { + match($0, /([^ \t]+) *=3D *kmemdup\(([^,]+) *,/, names) + if (debug) print "Found variable " names[1] " for table " names[2] + if (names[2] in entries) { + vars[names[1]] =3D names[2] + } +} + +/__register_sysctl_table.*/ { + match($0, /__register_sysctl_table\([^,]+, *"([^"]+)" *, *([^,]+)/, ta= bles) + if (debug) print "Registering variable table " tables[2] " at " tables= [1] + if (tables[1] =3D=3D table && tables[2] in vars) { + for (entry in entries[vars[tables[2]]]) { + printentry(entry) + } + } +} + END { for (entry in documented) { if (!seen[entry]) { --=20 2.43.2