linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] docs: Explain the desired position of function attributes
@ 2021-09-30 23:57 Kees Cook
  2021-10-01 19:05 ` Nick Desaulniers
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Kees Cook @ 2021-09-30 23:57 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Kees Cook, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Nick Desaulniers, Linus Torvalds, Rasmus Villemoes,
	Andrew Morton, linux-kernel, linux-doc, linux-hardening

While discussing how to format the addition of various function
attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
close as possible to Linus's preferences for future reference.

(Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
others that would prefer all attributes live on a separate leading line.)

[1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/

Signed-off-by: Kees Cook <keescook@chromium.org>
---
v4:
- fix another stray "void"! This is why code needs a compiler... (thx randy)
---
 Documentation/process/coding-style.rst | 30 ++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 42969ab37b34..45b48510f5ec 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -487,6 +487,36 @@ because it is a simple way to add valuable information for the reader.
 Do not use the ``extern`` keyword with function prototypes as this makes
 lines longer and isn't strictly necessary.
 
+When writing a function declarations, please keep the `order of elements regular
+<https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/>`_.
+For example::
+
+ extern __init void * __must_check action(enum magic value, size_t size, u8 count,
+ 					  char *fmt, ...) __printf(4, 5) __malloc;
+
+The preferred order of elements for a function prototype is:
+
+- storage class (here, ``extern``, and things like ``static __always_inline`` even though
+  ``__always_inline`` is technically an attribute, it is treated like ``inline``)
+- storage class attributes (here, ``__init`` -- i.e. section declarations, but also things like ``__cold``)
+- return type (here, ``void *``)
+- return type attributes (here, ``__must_check``)
+- function name (here, ``action``)
+- function parameters (here, ``(enum magic value, size_t size, u8 count, char *fmt, ...)``, noting that parameter names should always be included)
+- function parameter attributes (here, ``__printf(4, 5)``)
+- function behavior attributes (here, ``__malloc``)
+
+Note that for a function definition (e.g. ``static inline``), the compiler does
+not allow function parameter attributes after the function parameters. In these
+cases, they should go after the storage class attributes (e.g. note the changed
+position of ``__printf(4, 5)``)::
+
+ static __always_inline __init __printf(4, 5) void * __must_check action(enum magic value,
+ 		size_t size, u8 count, char *fmt, ...)
+ 		__malloc
+ {
+ 	...
+ }
 
 7) Centralized exiting of functions
 -----------------------------------
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-09-30 23:57 [PATCH v4] docs: Explain the desired position of function attributes Kees Cook
@ 2021-10-01 19:05 ` Nick Desaulniers
  2021-10-01 20:23   ` Joe Perches
                     ` (2 more replies)
  2021-10-02 10:46 ` Miguel Ojeda
  2021-10-04 23:09 ` Jonathan Corbet
  2 siblings, 3 replies; 15+ messages in thread
From: Nick Desaulniers @ 2021-10-01 19:05 UTC (permalink / raw)
  To: Kees Cook, Linus Torvalds, Miguel Ojeda
  Cc: Jonathan Corbet, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Rasmus Villemoes, Andrew Morton, linux-kernel, linux-doc,
	linux-hardening

On Thu, Sep 30, 2021 at 4:58 PM Kees Cook <keescook@chromium.org> wrote:
>
> While discussing how to format the addition of various function
> attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
> close as possible to Linus's preferences for future reference.
>
> (Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
> others that would prefer all attributes live on a separate leading line.)
>
> [1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

While I appreciate you getting the ball across the finish line (having
_any_ documentation to point to in future bikesheds), I can't help but
shake the feeling that the chosen policy will harm the ability of
existing automated code formatting tools from being able to automate
code formatting on the kernel.

> ---
> v4:
> - fix another stray "void"! This is why code needs a compiler... (thx randy)
> ---
>  Documentation/process/coding-style.rst | 30 ++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> index 42969ab37b34..45b48510f5ec 100644
> --- a/Documentation/process/coding-style.rst
> +++ b/Documentation/process/coding-style.rst
> @@ -487,6 +487,36 @@ because it is a simple way to add valuable information for the reader.
>  Do not use the ``extern`` keyword with function prototypes as this makes
>  lines longer and isn't strictly necessary.
>
> +When writing a function declarations, please keep the `order of elements regular
> +<https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/>`_.
> +For example::
> +
> + extern __init void * __must_check action(enum magic value, size_t size, u8 count,
> +                                         char *fmt, ...) __printf(4, 5) __malloc;
> +
> +The preferred order of elements for a function prototype is:
> +
> +- storage class (here, ``extern``, and things like ``static __always_inline`` even though
> +  ``__always_inline`` is technically an attribute, it is treated like ``inline``)
> +- storage class attributes (here, ``__init`` -- i.e. section declarations, but also things like ``__cold``)
> +- return type (here, ``void *``)
> +- return type attributes (here, ``__must_check``)
> +- function name (here, ``action``)
> +- function parameters (here, ``(enum magic value, size_t size, u8 count, char *fmt, ...)``, noting that parameter names should always be included)
> +- function parameter attributes (here, ``__printf(4, 5)``)
> +- function behavior attributes (here, ``__malloc``)
> +
> +Note that for a function definition (e.g. ``static inline``), the compiler does
> +not allow function parameter attributes after the function parameters. In these
> +cases, they should go after the storage class attributes (e.g. note the changed
> +position of ``__printf(4, 5)``)::
> +
> + static __always_inline __init __printf(4, 5) void * __must_check action(enum magic value,
> +               size_t size, u8 count, char *fmt, ...)
> +               __malloc
> + {
> +       ...
> + }
>
>  7) Centralized exiting of functions
>  -----------------------------------
> --
> 2.30.2
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-01 19:05 ` Nick Desaulniers
@ 2021-10-01 20:23   ` Joe Perches
  2021-10-02  0:00   ` Kees Cook
  2021-10-02  6:31   ` Greg KH
  2 siblings, 0 replies; 15+ messages in thread
From: Joe Perches @ 2021-10-01 20:23 UTC (permalink / raw)
  To: Nick Desaulniers, Kees Cook, Linus Torvalds, Miguel Ojeda
  Cc: Jonathan Corbet, Randy Dunlap, Alexey Dobriyan, Rasmus Villemoes,
	Andrew Morton, linux-kernel, linux-doc, linux-hardening

On Fri, 2021-10-01 at 12:05 -0700, Nick Desaulniers wrote:
> On Thu, Sep 30, 2021 at 4:58 PM Kees Cook <keescook@chromium.org> wrote:
> > 
> > While discussing how to format the addition of various function
> > attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
> > close as possible to Linus's preferences for future reference.
> > 
> > (Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
> > others that would prefer all attributes live on a separate leading line.)
> > 
> > [1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/
> > 
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> While I appreciate you getting the ball across the finish line (having
> _any_ documentation to point to in future bikesheds), I can't help but
> shake the feeling that the chosen policy will harm the ability of
> existing automated code formatting tools from being able to automate
> code formatting on the kernel.

yup.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-01 19:05 ` Nick Desaulniers
  2021-10-01 20:23   ` Joe Perches
@ 2021-10-02  0:00   ` Kees Cook
  2021-10-02  6:31   ` Greg KH
  2 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2021-10-02  0:00 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linus Torvalds, Miguel Ojeda, Jonathan Corbet, Randy Dunlap,
	Joe Perches, Alexey Dobriyan, Rasmus Villemoes, Andrew Morton,
	linux-kernel, linux-doc, linux-hardening

On Fri, Oct 01, 2021 at 12:05:25PM -0700, Nick Desaulniers wrote:
> On Thu, Sep 30, 2021 at 4:58 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > While discussing how to format the addition of various function
> > attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
> > close as possible to Linus's preferences for future reference.
> >
> > (Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
> > others that would prefer all attributes live on a separate leading line.)
> >
> > [1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/
> >
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> While I appreciate you getting the ball across the finish line (having
> _any_ documentation to point to in future bikesheds), I can't help but
> shake the feeling that the chosen policy will harm the ability of
> existing automated code formatting tools from being able to automate
> code formatting on the kernel.

I am but the messenger here. Is there something specific that'll break
if we follow this?

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-01 19:05 ` Nick Desaulniers
  2021-10-01 20:23   ` Joe Perches
  2021-10-02  0:00   ` Kees Cook
@ 2021-10-02  6:31   ` Greg KH
  2021-10-02 10:42     ` Miguel Ojeda
  2021-10-02 15:21     ` Joe Perches
  2 siblings, 2 replies; 15+ messages in thread
From: Greg KH @ 2021-10-02  6:31 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Kees Cook, Linus Torvalds, Miguel Ojeda, Jonathan Corbet,
	Randy Dunlap, Joe Perches, Alexey Dobriyan, Rasmus Villemoes,
	Andrew Morton, linux-kernel, linux-doc, linux-hardening

On Fri, Oct 01, 2021 at 12:05:25PM -0700, Nick Desaulniers wrote:
> On Thu, Sep 30, 2021 at 4:58 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > While discussing how to format the addition of various function
> > attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
> > close as possible to Linus's preferences for future reference.
> >
> > (Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
> > others that would prefer all attributes live on a separate leading line.)
> >
> > [1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/
> >
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> While I appreciate you getting the ball across the finish line (having
> _any_ documentation to point to in future bikesheds), I can't help but
> shake the feeling that the chosen policy will harm the ability of
> existing automated code formatting tools from being able to automate
> code formatting on the kernel.

Why would documenting the expected format have an affect on tools not
being able to follow that exact expected format?  Are we defining a
format that is somehow impossible for them to use?

If anything I would think that now we have a format that the tools can
actually follow, while before it was semi-random as to what to pick as
the "one true way".

What am I missing here?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-02  6:31   ` Greg KH
@ 2021-10-02 10:42     ` Miguel Ojeda
  2021-10-02 15:22       ` Joe Perches
  2021-10-02 15:21     ` Joe Perches
  1 sibling, 1 reply; 15+ messages in thread
From: Miguel Ojeda @ 2021-10-02 10:42 UTC (permalink / raw)
  To: Greg KH
  Cc: Nick Desaulniers, Kees Cook, Linus Torvalds, Miguel Ojeda,
	Jonathan Corbet, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Rasmus Villemoes, Andrew Morton, linux-kernel,
	Linux Doc Mailing List, linux-hardening

On Sat, Oct 2, 2021 at 8:31 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> Why would documenting the expected format have an affect on tools not
> being able to follow that exact expected format?  Are we defining a
> format that is somehow impossible for them to use?

From a quick test, clang-format-12 with our current config keeps
attributes in the same line and it does not seem to reorder them, so
it seems OK (the developer has to do it by hand, but that is fine)
except for the `__malloc` in the second example which is in a
different line (but not in the first). Is that intended?

> If anything I would think that now we have a format that the tools can
> actually follow, while before it was semi-random as to what to pick as
> the "one true way".

In the future, clang-format could have a configuration option to pass
a sort order, in which case, having the sort order already defined in
the kernel would definitely be helpful.

In fact, we could use the fact that the kernel has one as a way to
tell upstream that such a feature would be nice to have :)

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-09-30 23:57 [PATCH v4] docs: Explain the desired position of function attributes Kees Cook
  2021-10-01 19:05 ` Nick Desaulniers
@ 2021-10-02 10:46 ` Miguel Ojeda
  2021-10-04 23:09 ` Jonathan Corbet
  2 siblings, 0 replies; 15+ messages in thread
From: Miguel Ojeda @ 2021-10-02 10:46 UTC (permalink / raw)
  To: Kees Cook
  Cc: Jonathan Corbet, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Nick Desaulniers, Linus Torvalds, Rasmus Villemoes,
	Andrew Morton, linux-kernel, Linux Doc Mailing List,
	linux-hardening

On Fri, Oct 1, 2021 at 1:59 AM Kees Cook <keescook@chromium.org> wrote:
>
> + static __always_inline __init __printf(4, 5) void * __must_check action(enum magic value,
> +               size_t size, u8 count, char *fmt, ...)
> +               __malloc

(From my other email) Is this `__malloc` intended to be in a separate
line? (the first example has everything on the same line).

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-02  6:31   ` Greg KH
  2021-10-02 10:42     ` Miguel Ojeda
@ 2021-10-02 15:21     ` Joe Perches
  2021-10-02 16:27       ` Miguel Ojeda
  1 sibling, 1 reply; 15+ messages in thread
From: Joe Perches @ 2021-10-02 15:21 UTC (permalink / raw)
  To: Greg KH, Nick Desaulniers
  Cc: Kees Cook, Linus Torvalds, Miguel Ojeda, Jonathan Corbet,
	Randy Dunlap, Alexey Dobriyan, Rasmus Villemoes, Andrew Morton,
	linux-kernel, linux-doc, linux-hardening

On Sat, 2021-10-02 at 08:31 +0200, Greg KH wrote:
> I would think that now we have a format that the tools can
> actually follow, while before it was semi-random as to what to pick as
> the "one true way".

There will never be 'one true (and universal) way'.

Most existing code doesn't follow the suggested formatting and you
can't require or expect the existing code to change.

If automated scripts exist to change all the code to that new
'one true way', it wouldn't be applied.
 
> What am I missing here?

Try writing a regex for the proposal and make sure to separate out
all the various __<foo> attributes into their proper locations...

yuck and g'luck.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-02 10:42     ` Miguel Ojeda
@ 2021-10-02 15:22       ` Joe Perches
  2021-10-02 16:29         ` Miguel Ojeda
  0 siblings, 1 reply; 15+ messages in thread
From: Joe Perches @ 2021-10-02 15:22 UTC (permalink / raw)
  To: Miguel Ojeda, Greg KH
  Cc: Nick Desaulniers, Kees Cook, Linus Torvalds, Miguel Ojeda,
	Jonathan Corbet, Randy Dunlap, Alexey Dobriyan, Rasmus Villemoes,
	Andrew Morton, linux-kernel, Linux Doc Mailing List,
	linux-hardening

On Sat, 2021-10-02 at 12:42 +0200, Miguel Ojeda wrote:
> In the future, clang-format could have a configuration option to pass
> a sort order, in which case, having the sort order already defined in
> the kernel would definitely be helpful.

It's not so much a sort order so much as it's a positional one.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-02 15:21     ` Joe Perches
@ 2021-10-02 16:27       ` Miguel Ojeda
  2021-10-02 21:42         ` Kees Cook
  0 siblings, 1 reply; 15+ messages in thread
From: Miguel Ojeda @ 2021-10-02 16:27 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg KH, Nick Desaulniers, Kees Cook, Linus Torvalds,
	Miguel Ojeda, Jonathan Corbet, Randy Dunlap, Alexey Dobriyan,
	Rasmus Villemoes, Andrew Morton, linux-kernel,
	Linux Doc Mailing List, linux-hardening

On Sat, Oct 2, 2021 at 5:22 PM Joe Perches <joe@perches.com> wrote:
>
> If automated scripts exist to change all the code to that new
> 'one true way', it wouldn't be applied.

I think nobody is saying we should reformat all code at once, just
that agreeing on a given style allows us to eventually automate it (it
also makes humans more likely to be consistent).

> Try writing a regex for the proposal and make sure to separate out
> all the various __<foo> attributes into their proper locations...

It does not need to be a regex...

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-02 15:22       ` Joe Perches
@ 2021-10-02 16:29         ` Miguel Ojeda
  0 siblings, 0 replies; 15+ messages in thread
From: Miguel Ojeda @ 2021-10-02 16:29 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg KH, Nick Desaulniers, Kees Cook, Linus Torvalds,
	Miguel Ojeda, Jonathan Corbet, Randy Dunlap, Alexey Dobriyan,
	Rasmus Villemoes, Andrew Morton, linux-kernel,
	Linux Doc Mailing List, linux-hardening

On Sat, Oct 2, 2021 at 5:22 PM Joe Perches <joe@perches.com> wrote:
>
> It's not so much a sort order so much as it's a positional one.

Sure, there are two parts, the order w.r.t. the signature parts (e.g.
"before return type") and the order between the attributes themselves.
Both are included in what I meant.

By the way, clang-format-13 already has a way to pass it a list of the
"attribute macros" (such as `__unused`), so adding more information on
top seems reasonable.

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-02 16:27       ` Miguel Ojeda
@ 2021-10-02 21:42         ` Kees Cook
  0 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2021-10-02 21:42 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Joe Perches, Greg KH, Nick Desaulniers, Linus Torvalds,
	Miguel Ojeda, Jonathan Corbet, Randy Dunlap, Alexey Dobriyan,
	Rasmus Villemoes, Andrew Morton, linux-kernel,
	Linux Doc Mailing List, linux-hardening

On Sat, Oct 02, 2021 at 06:27:02PM +0200, Miguel Ojeda wrote:
> On Sat, Oct 2, 2021 at 5:22 PM Joe Perches <joe@perches.com> wrote:
> >
> > If automated scripts exist to change all the code to that new
> > 'one true way', it wouldn't be applied.
> 
> I think nobody is saying we should reformat all code at once, just
> that agreeing on a given style allows us to eventually automate it (it
> also makes humans more likely to be consistent).

I just want to know what style to use to not have it NAKed by Linus. ;)

But yeah, it might be nice to do style checking against the kernel some
day. We have a lot of weird stuff in here, though! *slaps roof of kernel*

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-09-30 23:57 [PATCH v4] docs: Explain the desired position of function attributes Kees Cook
  2021-10-01 19:05 ` Nick Desaulniers
  2021-10-02 10:46 ` Miguel Ojeda
@ 2021-10-04 23:09 ` Jonathan Corbet
  2021-10-05  8:28   ` Miguel Ojeda
  2 siblings, 1 reply; 15+ messages in thread
From: Jonathan Corbet @ 2021-10-04 23:09 UTC (permalink / raw)
  To: Kees Cook
  Cc: Kees Cook, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Nick Desaulniers, Linus Torvalds, Rasmus Villemoes,
	Andrew Morton, linux-kernel, linux-doc, linux-hardening

Kees Cook <keescook@chromium.org> writes:

> While discussing how to format the addition of various function
> attributes, some "unwritten rules" of ordering surfaced[1]. Capture as
> close as possible to Linus's preferences for future reference.
>
> (Though I note the dissent voiced by Joe Perches, Alexey Dobriyan, and
> others that would prefer all attributes live on a separate leading line.)
>
> [1] https://lore.kernel.org/mm-commits/CAHk-=wiOCLRny5aifWNhr621kYrJwhfURsa0vFPeUEm8mF0ufg@mail.gmail.com/
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v4:
> - fix another stray "void"! This is why code needs a compiler... (thx randy)
> ---
>  Documentation/process/coding-style.rst | 30 ++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)

Did I ever mention that I *hate* coding-style patches? :)

In this case I think we're as close as to consensus as things get.  In
the absence of a strong reason to the contrary, I'll apply this before
too long.

Thanks,

jon

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-04 23:09 ` Jonathan Corbet
@ 2021-10-05  8:28   ` Miguel Ojeda
  2021-10-05 14:58     ` Kees Cook
  0 siblings, 1 reply; 15+ messages in thread
From: Miguel Ojeda @ 2021-10-05  8:28 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Kees Cook, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Nick Desaulniers, Linus Torvalds, Rasmus Villemoes,
	Andrew Morton, linux-kernel, Linux Doc Mailing List,
	linux-hardening

On Tue, Oct 5, 2021 at 1:57 AM Jonathan Corbet <corbet@lwn.net> wrote:
>
> In this case I think we're as close as to consensus as things get.  In
> the absence of a strong reason to the contrary, I'll apply this before
> too long.

No strong reason, but there was the question about the `__malloc` in a
separate line in the second example which seems to contradict the
declaration and it is not explained otherwise (+ clang-format does it
differently).

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4] docs: Explain the desired position of function attributes
  2021-10-05  8:28   ` Miguel Ojeda
@ 2021-10-05 14:58     ` Kees Cook
  0 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2021-10-05 14:58 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Jonathan Corbet, Randy Dunlap, Joe Perches, Alexey Dobriyan,
	Nick Desaulniers, Linus Torvalds, Rasmus Villemoes,
	Andrew Morton, linux-kernel, Linux Doc Mailing List,
	linux-hardening

On Tue, Oct 05, 2021 at 10:28:40AM +0200, Miguel Ojeda wrote:
> On Tue, Oct 5, 2021 at 1:57 AM Jonathan Corbet <corbet@lwn.net> wrote:
> >
> > In this case I think we're as close as to consensus as things get.  In
> > the absence of a strong reason to the contrary, I'll apply this before
> > too long.
> 
> No strong reason, but there was the question about the `__malloc` in a
> separate line in the second example which seems to contradict the
> declaration and it is not explained otherwise (+ clang-format does it
> differently).

I'll send a v5 -- the "extern" also needs to be dropped.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-10-05 14:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30 23:57 [PATCH v4] docs: Explain the desired position of function attributes Kees Cook
2021-10-01 19:05 ` Nick Desaulniers
2021-10-01 20:23   ` Joe Perches
2021-10-02  0:00   ` Kees Cook
2021-10-02  6:31   ` Greg KH
2021-10-02 10:42     ` Miguel Ojeda
2021-10-02 15:22       ` Joe Perches
2021-10-02 16:29         ` Miguel Ojeda
2021-10-02 15:21     ` Joe Perches
2021-10-02 16:27       ` Miguel Ojeda
2021-10-02 21:42         ` Kees Cook
2021-10-02 10:46 ` Miguel Ojeda
2021-10-04 23:09 ` Jonathan Corbet
2021-10-05  8:28   ` Miguel Ojeda
2021-10-05 14:58     ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).