Skip to contentSkip to conversation

MAINTAINERS: hardening: Add __counted_by regex

PATCH In review Kees Cook 3 participants 4 messages Sep 25, 2023 – Sep 26, 2023

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 MAINTAINERS: hardening: Add __counted_by regex

Since __counted_by annotations may also require that code be changed to get initialization ordering correct, let's get an extra group of eyes on code that is working on these annotations.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 737dcc7a2155..741285b8246e 100644
@@ -11405,6 +11405,7 @@ F:	kernel/configs/hardening.config
 F:	mm/usercopy.c
 K:	\b(add|choose)_random_kstack_offset\b
 K:	\b__check_(object_size|heap_object)\b
+K:	\b__counted_by\b
 
 KERNEL JANITORS
 L:	[email protected]
Signature · 1 line
2.34.1
#1 lore raw

Hi Kees,

Quoted 14 lines · Kees Cook

Since __counted_by annotations may also require that code be changed to get initialization ordering correct, let's get an extra group of eyes on code that is working on these annotations.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +0 -0
index 737dcc7a2155..741285b8246e 100644

MAINTAINERS F: kernel/configs/hardening.config · line 11409

Quoted 5 lines
MAINTAINERS +1 -0
@@ -11405,6 +11405,7 @@ F:	kernel/configs/hardening.config
 F:	mm/usercopy.c
 K:	\b(add|choose)_random_kstack_offset\b
 K:	\b__check_(object_size|heap_object)\b
+K:	\b__counted_by\b
 

Are you sure you want to volunteer to maintain every file that contains "__counted_by"? That's what "K" does; get_maintainer.pl will list you (and [email protected]) for every such file.

Other users of "K" have been surprised by this behavior. It seems that most people expect it to only apply to patches, not to files. Given that you're interested in using this functionality, have you considered updating checkpatch.pl to handle it in the way that you probably expect that it works?

- Eric

#2 lore raw
Quoted 13 lines · Eric Biggers

Hi Kees,

Quoted 9 lines · Kees Cook

Since __counted_by annotations may also require that code be changed to get initialization ordering correct, let's get an extra group of eyes on code that is working on these annotations.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines

MAINTAINERS F: kernel/configs/hardening.config · line 11409

Quoted 10 lines
MAINTAINERS +1 -0
index 737dcc7a2155..741285b8246e 100644
@@ -11405,6 +11405,7 @@ F:    kernel/configs/hardening.config
 F:   mm/usercopy.c
 K:   \b(add|choose)_random_kstack_offset\b
 K:   \b__check_(object_size|heap_object)\b
+K:   \b__counted_by\b
 

Are you sure you want to volunteer to maintain every file that contains "__counted_by"? That's what "K" does; get_maintainer.pl will list you (and [email protected]) for every such file.

Do people call get_maintainer.pl on specific tree files as opposed to invoking it against a .patch file? In the event of the .patch file "K:" should only pick-up what's in the patch and not read into the files outside of the context that the diff provides.

If needed, I could send a patch adding a "D:" which would only consider patches and not tree files -- reducing noise.

Quoted 8 lines

Other users of "K" have been surprised by this behavior. It seems that most people expect it to only apply to patches, not to files. Given that you're interested in using this functionality, have you considered updating checkpatch.pl to handle it in the way that you probably expect that it works?

- Eric

Thanks
Justin

#3 lore raw
Quoted 30 lines · Justin Stitt
Quoted 13 lines · Eric Biggers

Hi Kees,

Quoted 9 lines · Kees Cook

Since __counted_by annotations may also require that code be changed to get initialization ordering correct, let's get an extra group of eyes on code that is working on these annotations.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines

MAINTAINERS F: kernel/configs/hardening.config · line 11409

Quoted 10 lines
MAINTAINERS +1 -0
index 737dcc7a2155..741285b8246e 100644
@@ -11405,6 +11405,7 @@ F:    kernel/configs/hardening.config
 F:   mm/usercopy.c
 K:   \b(add|choose)_random_kstack_offset\b
 K:   \b__check_(object_size|heap_object)\b
+K:   \b__counted_by\b
 

Are you sure you want to volunteer to maintain every file that contains "__counted_by"? That's what "K" does; get_maintainer.pl will list you (and [email protected]) for every such file.

Quoted 4 lines

Do people call get_maintainer.pl on specific tree files as opposed to invoking it against a .patch file? In the event of the .patch file "K:" should only pick-up what's in the patch and not read into the files outside of the context that the diff provides.

FWIW, b4 just uses the patches and not entire files:

...
try:
tos, ccs, tag_msg, patches = get_prep_branch_as_patches()
except RuntimeError:
logger.info('No commits in branch')
return

logger.info('Collecting To/Cc addresses') # Go through the messages to make to/cc headers for commit, msg in patches:
if not msg or not commit:
continue

logger.debug('Collecting from: %s', msg.get('subject')) msgbytes = msg.as_bytes()
...

Quoted 15 lines

If needed, I could send a patch adding a "D:" which would only consider patches and not tree files -- reducing noise.

Quoted 8 lines

Other users of "K" have been surprised by this behavior. It seems that most people expect it to only apply to patches, not to files. Given that you're interested in using this functionality, have you considered updating checkpatch.pl to handle it in the way that you probably expect that it works?

- Eric

Thanks
Justin