Skip to contentSkip to conversation

Kbuild: Elevate sha1sum to sha256sum for atomic headers check

PATCH In review Bhaskar Chowdhury 2 participants 3 messages Mar 15, 2023 – Mar 18, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Kbuild: Elevate sha1sum to sha256sum for atomic headers check

Thought it would be a good idea to use a elevated mechanism i.e sha256sum

---
 Kbuild | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Kbuild +5 -5
index 464b34a08f51..b74040346d76 100644
@@ -45,14 +45,14 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file)
 
 # Check the manual modification of atomic headers
 
-quiet_cmd_check_sha1 = CHKSHA1 $<
-      cmd_check_sha1 = \
-	if ! command -v sha1sum >/dev/null; then \
-		echo "warning: cannot check the header due to sha1sum missing"; \
+quiet_cmd_check_sha256 = CHKSHA256 $<
+      cmd_check_sha256 = \
+	if ! command -v sha256sum >/dev/null; then \
+		echo "warning: cannot check the header due to sha256sum missing"; \
 		exit 0; \
 	fi; \
 	if [ "$$(sed -n '$$s:// ::p' $<)" != \
-	     "$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
+	     "$$(sed '$$d' $< | sha256sum | sed 's/ .*//')" ]; then \
 		echo "error: $< has been modified." >&2; \
 		exit 1; \
 	fi; \

--
2.39.2

#1 lore raw

From: Bhaskar Chowdhury

Quoted 3 lines

Sent: 15 March 2023 13:05

Thought it would be a good idea to use a elevated mechanism i.e sha256sum

How can this change possibly work.
It is just a list of definitions read by another makefile. You've changed the name of a definition without changing where it is used. Also if the code is looking for a change, you'd need to change what it is compared against.
In any case no one is worried about malicious attempts to change things without being noticed, even sha1 is OTT.

David

Quoted 31 lines
---
 Kbuild | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Kbuild +5 -6
index 464b34a08f51..b74040346d76 100644
@@ -45,14 +45,14 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file)
 
 # Check the manual modification of atomic headers
 
-quiet_cmd_check_sha1 = CHKSHA1 $<
-      cmd_check_sha1 = \
-	if ! command -v sha1sum >/dev/null; then \
-		echo "warning: cannot check the header due to sha1sum missing"; \
+quiet_cmd_check_sha256 = CHKSHA256 $<
+      cmd_check_sha256 = \
+	if ! command -v sha256sum >/dev/null; then \
+		echo "warning: cannot check the header due to sha256sum missing"; \
 		exit 0; \
 	fi; \
 	if [ "$$(sed -n '$$s:// ::p' $<)" != \
-	     "$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
+	     "$$(sed '$$d' $< | sha256sum | sed 's/ .*//')" ]; then \
 		echo "error: $< has been modified." >&2; \
 		exit 1; \
 	fi; \
--
Quoted 1 line

2.39.2

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)

#2 lore raw
Quoted 10 lines · David Laight

From: Bhaskar Chowdhury

Quoted 3 lines

Sent: 15 March 2023 13:05

Thought it would be a good idea to use a elevated mechanism i.e sha256sum

How can this change possibly work.
It is just a list of definitions read by another makefile. You've changed the name of a definition without changing where it is used. Also if the code is looking for a change, you'd need to change what it is compared against.

Gotcha. Thanks for the heads-up , David. I missed it.

Quoted 33 lines

In any case no one is worried about malicious attempts to change things without being noticed, even sha1 is OTT.

David

Quoted 28 lines
---
 Kbuild | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Kbuild +5 -5
index 464b34a08f51..b74040346d76 100644
@@ -45,14 +45,14 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file)
 
 # Check the manual modification of atomic headers
 
-quiet_cmd_check_sha1 = CHKSHA1 $<
-      cmd_check_sha1 = \
-     if ! command -v sha1sum >/dev/null; then \
-             echo "warning: cannot check the header due to sha1sum missing"; \
+quiet_cmd_check_sha256 = CHKSHA256 $<
+      cmd_check_sha256 = \
+     if ! command -v sha256sum >/dev/null; then \
+             echo "warning: cannot check the header due to sha256sum missing"; \
              exit 0; \
      fi; \
      if [ "$$(sed -n '$$s:// ::p' $<)" != \
-          "$$(sed '$$d' $< | sha1sum | sed 's/ .*//')" ]; then \
+          "$$(sed '$$d' $< | sha256sum | sed 's/ .*//')" ]; then \
              echo "error: $< has been modified." >&2; \
Quoted 8 lines
Quoted 4 lines
Kbuild +0 -1
              exit 1; \
      fi; \
--

2.39.2

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)

--
Thanks,
Bhaskar

"Here's looking at you kid"-- Casablanca
https://about.me/unixbhaskar