lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 Apr 2023 01:02:26 +0200 (CEST)
From:   Michal Kubecek <mkubecek@...e.cz>
To:     netdev@...r.kernel.org
Cc:     Thomas Devoogdt <thomas@...oogdt.com>
Subject: [PATCH ethtool 2/3] scripts: add all included uapi files on update

On multiple occasions, we had to add another uapi header copy to fix build
on older system where system <linux/...> headers in /usr/include lacked
recent definitions or changes. To prevent these problems, update the
ethtool-import-uapi script to add all uapi headers included either from
a source file or from already copied uapi header which are not present yet.

Omit <asm/...> headers as those are architecture dependent so that we
cannot pick one random version depending on architecture a developer runs
the script on and having all versions and selecting the right one would be
too complicated.

Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
 scripts/ethtool-import-uapi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/scripts/ethtool-import-uapi b/scripts/ethtool-import-uapi
index 8e48332cfcc8..a04a9c971a01 100755
--- a/scripts/ethtool-import-uapi
+++ b/scripts/ethtool-import-uapi
@@ -29,6 +29,32 @@ popd
 
 pushd uapi
 find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
+
+go_on=true
+while $go_on; do
+    go_on=false
+    while read f; do
+        if [ "${f#asm/}" != "$f" ]; then
+            # skip architecture dependent asm/ headers
+            continue
+        fi
+        if [ -f "$f" ]; then
+            # already present
+            continue
+        fi
+	if [ ! -f "${kobj}/hdr/include/${f}" ]; then
+            # not a kernel header
+            continue
+        fi
+        echo "+ add $f"
+        go_on=true
+        mkdir -p "${f%/*}"
+        cp "${kobj}/hdr/include/${f}" "${f}"
+    done < <(
+        find . -type f -name '*.[ch]' -exec sed -nre '\_^[[:blank:]]*#include[[:blank:]]<.+>_ { s_^[[:blank:]]*#include[[:blank:]]<([^>]*)>.*$_\1_ ; p }' {} \; \
+            | LC_ALL=C sort -u
+    )
+done
 popd
 rm -rf "$kobj"
 
-- 
2.40.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ