Skip to contentSkip to conversation

checkpatch: add fix for BAD_SIGN_OFF

PATCH In review Aditya Srivastava 2 participants 8 messages Nov 3, 2020 – Nov 8, 2020 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: add fix for BAD_SIGN_OFF

Currently, checkpatch warns us if the author of the commit signs-off as co-developed-by.
E.g. for commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre") we get:

WARNING: Co-developed-by: should not be used to attribute nominal patch author 'Tim Chen <[email protected]>'

Provide a simple fix by removing the co-developed-by line from the commit message

---
 scripts/checkpatch.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +5 -2
index 58095d9d8f34..1030d4fc2abf 100755
@@ -2827,8 +2827,11 @@ sub process {
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
 			if ($sign_off =~ /^co-developed-by:$/i) {
 				if ($email eq $author) {
-					WARN("BAD_SIGN_OFF",
-					      "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
+					if (WARN("BAD_SIGN_OFF",
+						 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
+					    $fix) {
+						fix_delete_line($fixlinenr, $rawline);
+					}
 				}
 				if (!defined $lines[$linenr]) {
 					WARN("BAD_SIGN_OFF",
Signature · 6 lines
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#1 lore raw
Quoted 6 lines · Aditya Srivastava

Currently, checkpatch warns us if the author of the commit signs-off as co-developed-by.
E.g. for commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre") we get:

Quoted 7 lines

WARNING: Co-developed-by: should not be used to attribute nominal patch author 'Tim Chen <[email protected]>'

Provide a simple fix by removing the co-developed-by line from the commit message

Patch looks good. Maybe you can add a statistics on how many cases of the last 200,000 commits this rule would actually trigger?

E.g., you can probably quickly filter all commits that have at least one Co-developed-by tag among those last 200,000 commits (that is already only a few thousands), then take that list and just check with checkpatch.pl for this one rule quickly to see how often the rule would even trigger at all.

Once you have that and explain that in the commit message, I think the patch is ready for lkml and Joe Perches.

Lukas

Quoted 24 lines
---
 scripts/checkpatch.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +5 -3
index 58095d9d8f34..1030d4fc2abf 100755
@@ -2827,8 +2827,11 @@ sub process {
 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
                        if ($sign_off =~ /^co-developed-by:$/i) {
                                if ($email eq $author) {
-                                       WARN("BAD_SIGN_OFF",
-                                             "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
+                                       if (WARN("BAD_SIGN_OFF",
+                                                "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline) &&
+                                           $fix) {
+                                               fix_delete_line($fixlinenr, $rawline);
+                                       }
                                }
                                if (!defined $lines[$linenr]) {
                                        WARN("BAD_SIGN_OFF",
--
Quoted 2 lines

2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#2 lore raw
Quoted 24 lines · Lukas Bulwahn
Quoted 6 lines · Aditya Srivastava

Currently, checkpatch warns us if the author of the commit signs-off as co-developed-by.
E.g. for commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre") we get:

Quoted 7 lines

WARNING: Co-developed-by: should not be used to attribute nominal patch author 'Tim Chen <[email protected]>'

Provide a simple fix by removing the co-developed-by line from the commit message

Patch looks good. Maybe you can add a statistics on how many cases of the last 200,000 commits this rule would actually trigger?

E.g., you can probably quickly filter all commits that have at least one Co-developed-by tag among those last 200,000 commits (that is already only a few thousands), then take that list and just check with checkpatch.pl for this one rule quickly to see how often the rule would even trigger at all.

Quoted 5 lines

Once you have that and explain that in the commit message, I think the patch is ready for lkml and Joe Perches.

Lukas

Hi Sir
I generated a report for around 200,000 commits (v4.13..v5.8), and found that this rule was being triggered only 6 times. Statistically this doesn't seem much. Is it still advisable to mention it in the commit message?
Although, there's a possibility that user fixed this issue after receiving the warning manually before committing.

Thanks
Aditya

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw
Quoted 32 lines · Aditya
Quoted 1 line · Lukas Bulwahn

On Tue, Nov 3, 2020 at 4:19 PM Aditya Srivastava <[email protected]>

Quoted 23 lines · wrote:
Quoted 6 lines

Currently, checkpatch warns us if the author of the commit signs-off as co-developed-by.
E.g. for commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre") we get:

Quoted 7 lines

WARNING: Co-developed-by: should not be used to attribute nominal patch author 'Tim Chen <[email protected]>'

Provide a simple fix by removing the co-developed-by line from the commit message

Patch looks good. Maybe you can add a statistics on how many cases of the last 200,000 commits this rule would actually trigger?

E.g., you can probably quickly filter all commits that have at least one Co-developed-by tag among those last 200,000 commits (that is already only a few thousands), then take that list and just check with checkpatch.pl for this one rule quickly to see how often the rule would even trigger at all.

Quoted 5 lines

Once you have that and explain that in the commit message, I think the patch is ready for lkml and Joe Perches.

Lukas

Quoted 8 lines

Hi Sir
I generated a report for around 200,000 commits (v4.13..v5.8), and found that this rule was being triggered only 6 times. Statistically this doesn't seem much. Is it still advisable to mention it in the commit message?
Although, there's a possibility that user fixed this issue after receiving the warning manually before committing.

Can you share the six commits?

Then we check if the fix is really the right fix of if something different is wrong with these commits.

This certainly needs to be mentioned in the commit message.

Lukas

Quoted 4 lines

Thanks
Aditya

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#4 lore raw
Quoted 6 lines · Lukas Bulwahn

Can you share the six commits?

Then we check if the fix is really the right fix of if something different is wrong with these commits.

These are the commits where this warning for BAD_SIGN_OFF was getting triggered(over 4.13..5.8):
1) Commit 1d1f898df658 ("rcu: Do RCU GP kthread self-wakeup from softirq and interrupt")
2) Commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre")
3) Commit a35d16905efc ("rcu: Add basic support for kfree_rcu() batching")
4) Commit b7e4aadef28f ("locking/spinlocks: Document the semantics of spin_is_locked()")
5) Commit 621df431b0ac ("Documentation/memory-barriers.txt:
Cross-reference "tools/memory-model/"")
6) Commit 1c27b644c0fd ("Automate memory-barriers.txt; provide Linux-kernel memory model")

Quoted 2 lines

This certainly needs to be mentioned in the commit message.

Okay.

Thanks
Aditya

Quoted 4 lines

Lukas

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#5 lore raw
Quoted 9 lines · Aditya
Quoted 6 lines · Lukas Bulwahn

Can you share the six commits?

Then we check if the fix is really the right fix of if something different is wrong with these commits.

Quoted 14 lines

These are the commits where this warning for BAD_SIGN_OFF was getting triggered(over 4.13..5.8):
1) Commit 1d1f898df658 ("rcu: Do RCU GP kthread self-wakeup from softirq and interrupt")
2) Commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre")
3) Commit a35d16905efc ("rcu: Add basic support for kfree_rcu() batching")
4) Commit b7e4aadef28f ("locking/spinlocks: Document the semantics of spin_is_locked()")
5) Commit 621df431b0ac ("Documentation/memory-barriers.txt:
Cross-reference "tools/memory-model/"")
6) Commit 1c27b644c0fd ("Automate memory-barriers.txt; provide Linux-kernel memory model")

I checked all six cases and think the proposed fix is always okay.

I guess there is still the warning that Co-developed-by: should immediately be followed up the Signed-off-by:, right?

A possible fix for that would be to check if the needed Signed-off-by:
follows somewhere and then just move that to the appropriate place in the patch.

When your patch includes this information on how many occurrences, you found and that all of the fixes are correct in those cases, this patch is ready for lkml and Joe Perches.

Joe will possibly ask to name the six commits, so he can check himself. But no need to add them in the commit message or so.

Lukas

Quoted 13 lines
Quoted 2 lines

This certainly needs to be mentioned in the commit message.

Okay.

Thanks
Aditya

Quoted 4 lines

Lukas

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#6 lore raw
Quoted 28 lines · Lukas Bulwahn
Quoted 9 lines · Aditya
Quoted 6 lines · Lukas Bulwahn

Can you share the six commits?

Then we check if the fix is really the right fix of if something different is wrong with these commits.

Quoted 14 lines

These are the commits where this warning for BAD_SIGN_OFF was getting triggered(over 4.13..5.8):
1) Commit 1d1f898df658 ("rcu: Do RCU GP kthread self-wakeup from softirq and interrupt")
2) Commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre")
3) Commit a35d16905efc ("rcu: Add basic support for kfree_rcu() batching")
4) Commit b7e4aadef28f ("locking/spinlocks: Document the semantics of spin_is_locked()")
5) Commit 621df431b0ac ("Documentation/memory-barriers.txt:
Cross-reference "tools/memory-model/"")
6) Commit 1c27b644c0fd ("Automate memory-barriers.txt; provide Linux-kernel memory model")

Quoted 9 lines

I checked all six cases and think the proposed fix is always okay.

I guess there is still the warning that Co-developed-by: should immediately be followed up the Signed-off-by:, right?

A possible fix for that would be to check if the needed Signed-off-by:
follows somewhere and then just move that to the appropriate place in the patch.

Should I add this in the current patch itself or create another patch for it?

Quoted 7 lines

When your patch includes this information on how many occurrences, you found and that all of the fixes are correct in those cases, this patch is ready for lkml and Joe Perches.

Joe will possibly ask to name the six commits, so he can check himself. But no need to add them in the commit message or so.

Okay.

Thanks
Aditya

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#7 lore raw
Quoted 36 lines · Aditya
Quoted 9 lines · Lukas Bulwahn
Quoted 5 lines · Aditya
Quoted 4 lines · Lukas Bulwahn

Can you share the six commits?

Then we check if the fix is really the right fix of if something

different

Quoted 11 lines
Quoted 11 lines
Quoted 2 lines

is wrong with these commits.

These are the commits where this warning for BAD_SIGN_OFF was getting triggered(over 4.13..5.8):
1) Commit 1d1f898df658 ("rcu: Do RCU GP kthread self-wakeup from softirq and interrupt")
2) Commit 6e88559470f5 ("Documentation: Add section about CPU vulnerabilities for Spectre")
3) Commit a35d16905efc ("rcu: Add basic support for kfree_rcu()

batching")

Quoted 13 lines
Quoted 7 lines

4) Commit b7e4aadef28f ("locking/spinlocks: Document the semantics of spin_is_locked()")
5) Commit 621df431b0ac ("Documentation/memory-barriers.txt:
Cross-reference "tools/memory-model/"")
6) Commit 1c27b644c0fd ("Automate memory-barriers.txt; provide Linux-kernel memory model")

I checked all six cases and think the proposed fix is always okay.

I guess there is still the warning that Co-developed-by: should immediately be followed up the Signed-off-by:, right?

Quoted 9 lines
Quoted 2 lines

A possible fix for that would be to check if the needed Signed-off-by:
follows somewhere and then just move that to the appropriate place in

the

Quoted 2 lines

patch.

Should I add this in the current patch itself or create another patch for it?

Make that further fix feature a new patch.

Lukas

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees