* + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch
@ 2023-04-12 0:24 Andrew Morton
2023-04-12 1:33 ` Masahiro Yamada
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2023-04-12 0:24 UTC (permalink / raw)
To: mm-commits, sam, ruben.ayrapetyan, pvorel, masahiroy,
kevin.brodsky, akpm
The patch titled
Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
has been added to the -mm mm-nonmm-unstable branch. Its filename is
uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Kevin Brodsky <kevin.brodsky@arm.com>
Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
Date: Tue, 11 Apr 2023 10:27:47 +0100
typeof is (still) a GNU extension, which means that it cannot be used when
building ISO C (e.g. -std=c99). It should therefore be avoided in uapi
headers in favour of the ISO-friendly __typeof__.
Unfortunately this issue could not be detected by
CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in
any uapi header.
Link: https://lkml.kernel.org/r/20230411092747.3759032-1-kevin.brodsky@arm.com
Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained")
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Reported-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
Tested-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/uapi/linux/const.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/include/uapi/linux/const.h~uapi-linux-consth-prefer-iso-friendly-__typeof__
+++ a/include/uapi/linux/const.h
@@ -28,7 +28,7 @@
#define _BITUL(x) (_UL(1) << (x))
#define _BITULL(x) (_ULL(1) << (x))
-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
_
Patches currently in -mm which might be from kevin.brodsky@arm.com are
uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch
2023-04-12 0:24 + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch Andrew Morton
@ 2023-04-12 1:33 ` Masahiro Yamada
2023-04-12 1:45 ` Andrew Morton
2023-04-12 5:34 ` Petr Vorel
0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2023-04-12 1:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: mm-commits, sam, ruben.ayrapetyan, pvorel, kevin.brodsky
On Wed, Apr 12, 2023 at 9:24 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
>
> The patch titled
> Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> has been added to the -mm mm-nonmm-unstable branch. Its filename is
> uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
>
> This patch will shortly appear at
> https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
>
> This patch will later appear in the mm-nonmm-unstable branch at
> git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next via the mm-everything
> branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> and is updated there every 2-3 working days
>
> ------------------------------------------------------
> From: Kevin Brodsky <kevin.brodsky@arm.com>
> Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> Date: Tue, 11 Apr 2023 10:27:47 +0100
>
> typeof is (still) a GNU extension, which means that it cannot be used when
> building ISO C (e.g. -std=c99). It should therefore be avoided in uapi
> headers in favour of the ISO-friendly __typeof__.
>
> Unfortunately this issue could not be detected by
> CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in
> any uapi header.
>
> Link: https://lkml.kernel.org/r/20230411092747.3759032-1-kevin.brodsky@arm.com
> Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained")
This tag is wrong.
The correct one is:
Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
<linux/const.h>")
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> Reported-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
> Tested-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Tested-by: Petr Vorel <pvorel@suse.cz>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> include/uapi/linux/const.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/include/uapi/linux/const.h~uapi-linux-consth-prefer-iso-friendly-__typeof__
> +++ a/include/uapi/linux/const.h
> @@ -28,7 +28,7 @@
> #define _BITUL(x) (_UL(1) << (x))
> #define _BITULL(x) (_ULL(1) << (x))
>
> -#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
> +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
> #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
>
> #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> _
>
> Patches currently in -mm which might be from kevin.brodsky@arm.com are
>
> uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch
2023-04-12 1:33 ` Masahiro Yamada
@ 2023-04-12 1:45 ` Andrew Morton
2023-04-12 5:34 ` Petr Vorel
1 sibling, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2023-04-12 1:45 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: mm-commits, sam, ruben.ayrapetyan, pvorel, kevin.brodsky
On Wed, 12 Apr 2023 10:33:02 +0900 Masahiro Yamada <masahiroy@kernel.org> wrote:
> > Link: https://lkml.kernel.org/r/20230411092747.3759032-1-kevin.brodsky@arm.com
> > Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained")
>
>
> This tag is wrong.
>
> The correct one is:
>
> Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
> <linux/const.h>")
Fixed, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch
2023-04-12 1:33 ` Masahiro Yamada
2023-04-12 1:45 ` Andrew Morton
@ 2023-04-12 5:34 ` Petr Vorel
2023-04-16 13:19 ` Masahiro Yamada
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2023-04-12 5:34 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, mm-commits, sam, ruben.ayrapetyan, kevin.brodsky
> On Wed, Apr 12, 2023 at 9:24 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> > The patch titled
> > Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> > has been added to the -mm mm-nonmm-unstable branch. Its filename is
> > uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
> > This patch will shortly appear at
> > https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
> > This patch will later appear in the mm-nonmm-unstable branch at
> > git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > Before you just go and hit "reply", please:
> > a) Consider who else should be cc'ed
> > b) Prefer to cc a suitable mailing list as well
> > c) Ideally: find the original patch on the mailing list and do a
> > reply-to-all to that, adding suitable additional cc's
> > *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> > The -mm tree is included into linux-next via the mm-everything
> > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > and is updated there every 2-3 working days
> > ------------------------------------------------------
> > From: Kevin Brodsky <kevin.brodsky@arm.com>
> > Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> > Date: Tue, 11 Apr 2023 10:27:47 +0100
> > typeof is (still) a GNU extension, which means that it cannot be used when
> > building ISO C (e.g. -std=c99). It should therefore be avoided in uapi
> > headers in favour of the ISO-friendly __typeof__.
> > Unfortunately this issue could not be detected by
> > CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in
> > any uapi header.
> > Link: https://lkml.kernel.org/r/20230411092747.3759032-1-kevin.brodsky@arm.com
> > Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained")
> This tag is wrong.
> The correct one is:
> Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
> <linux/const.h>")
I'm sorry if I misinterpreted the history. The reason why I think it was
d6fc9fcbaa65 (which introduced -std=c90) is because there was already some
typeof() uses before this commit (uapi/linux/kernel.h and
uapi/linux/netfilter/x_tables.h).
Kind regards,
Petr
> Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
> > Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> > Reported-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
> > Tested-by: Ruben Ayrapetyan <ruben.ayrapetyan@arm.com>
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
> > Tested-by: Petr Vorel <pvorel@suse.cz>
> > Cc: Masahiro Yamada <masahiroy@kernel.org>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> > include/uapi/linux/const.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > --- a/include/uapi/linux/const.h~uapi-linux-consth-prefer-iso-friendly-__typeof__
> > +++ a/include/uapi/linux/const.h
> > @@ -28,7 +28,7 @@
> > #define _BITUL(x) (_UL(1) << (x))
> > #define _BITULL(x) (_ULL(1) << (x))
> > -#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
> > +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
> > #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
> > #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
> > _
> > Patches currently in -mm which might be from kevin.brodsky@arm.com are
> > uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch
2023-04-12 5:34 ` Petr Vorel
@ 2023-04-16 13:19 ` Masahiro Yamada
2023-04-16 20:54 ` Petr Vorel
0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2023-04-16 13:19 UTC (permalink / raw)
To: Petr Vorel, Andrew Morton
Cc: mm-commits, sam, ruben.ayrapetyan, kevin.brodsky
Hi Andrew,
On Wed, Apr 12, 2023 at 2:34 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> > On Wed, Apr 12, 2023 at 9:24 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
>
> > > The patch titled
> > > Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> > > has been added to the -mm mm-nonmm-unstable branch. Its filename is
> > > uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
>
> > > This patch will shortly appear at
> > > https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
>
> > > This patch will later appear in the mm-nonmm-unstable branch at
> > > git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>
> > > Before you just go and hit "reply", please:
> > > a) Consider who else should be cc'ed
> > > b) Prefer to cc a suitable mailing list as well
> > > c) Ideally: find the original patch on the mailing list and do a
> > > reply-to-all to that, adding suitable additional cc's
>
> > > *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> > > The -mm tree is included into linux-next via the mm-everything
> > > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > > and is updated there every 2-3 working days
>
> > > ------------------------------------------------------
> > > From: Kevin Brodsky <kevin.brodsky@arm.com>
> > > Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> > > Date: Tue, 11 Apr 2023 10:27:47 +0100
>
> > > typeof is (still) a GNU extension, which means that it cannot be used when
> > > building ISO C (e.g. -std=c99). It should therefore be avoided in uapi
> > > headers in favour of the ISO-friendly __typeof__.
>
> > > Unfortunately this issue could not be detected by
> > > CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in
> > > any uapi header.
>
> > > Link: https://lkml.kernel.org/r/20230411092747.3759032-1-kevin.brodsky@arm.com
> > > Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained")
>
>
> > This tag is wrong.
>
> > The correct one is:
>
> > Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
> > <linux/const.h>")
>
> I'm sorry if I misinterpreted the history. The reason why I think it was
> d6fc9fcbaa65 (which introduced -std=c90) is because there was already some
> typeof() uses before this commit (uapi/linux/kernel.h and
> uapi/linux/netfilter/x_tables.h).
Sorry, I wrongly read the code.
Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
<linux/const.h>")
was also wrong.
Before a85cbe6159ff, 'typeof' existed in include/uapi/linux/kernel.h.
So, it was exported to userspace.
Kevin suspects 607ca46e97a1 ("UAPI: (Scripted) Disintegrate
include/linux"), but I think the issue goes back more.
I think the following is the first commit that exported it.
Fixes: a79ff731a1b2 ("netfilter: xtables: make XT_ALIGN() usable in
exported headers by exporting __ALIGN_KERNEL()")
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch
2023-04-16 13:19 ` Masahiro Yamada
@ 2023-04-16 20:54 ` Petr Vorel
0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2023-04-16 20:54 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrew Morton, mm-commits, sam, ruben.ayrapetyan, kevin.brodsky
> Hi Andrew,
> On Wed, Apr 12, 2023 at 2:34 PM Petr Vorel <pvorel@suse.cz> wrote:
> > > On Wed, Apr 12, 2023 at 9:24 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> > > > The patch titled
> > > > Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> > > > has been added to the -mm mm-nonmm-unstable branch. Its filename is
> > > > uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
> > > > This patch will shortly appear at
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/uapi-linux-consth-prefer-iso-friendly-__typeof__.patch
> > > > This patch will later appear in the mm-nonmm-unstable branch at
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > > > Before you just go and hit "reply", please:
> > > > a) Consider who else should be cc'ed
> > > > b) Prefer to cc a suitable mailing list as well
> > > > c) Ideally: find the original patch on the mailing list and do a
> > > > reply-to-all to that, adding suitable additional cc's
> > > > *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> > > > The -mm tree is included into linux-next via the mm-everything
> > > > branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> > > > and is updated there every 2-3 working days
> > > > ------------------------------------------------------
> > > > From: Kevin Brodsky <kevin.brodsky@arm.com>
> > > > Subject: uapi/linux/const.h: prefer ISO-friendly __typeof__
> > > > Date: Tue, 11 Apr 2023 10:27:47 +0100
> > > > typeof is (still) a GNU extension, which means that it cannot be used when
> > > > building ISO C (e.g. -std=c99). It should therefore be avoided in uapi
> > > > headers in favour of the ISO-friendly __typeof__.
> > > > Unfortunately this issue could not be detected by
> > > > CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in
> > > > any uapi header.
> > > > Link: https://lkml.kernel.org/r/20230411092747.3759032-1-kevin.brodsky@arm.com
> > > > Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained")
> > > This tag is wrong.
> > > The correct one is:
> > > Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
> > > <linux/const.h>")
> > I'm sorry if I misinterpreted the history. The reason why I think it was
> > d6fc9fcbaa65 (which introduced -std=c90) is because there was already some
> > typeof() uses before this commit (uapi/linux/kernel.h and
> > uapi/linux/netfilter/x_tables.h).
> Sorry, I wrongly read the code.
> Fixes: a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to
> <linux/const.h>")
> was also wrong.
> Before a85cbe6159ff, 'typeof' existed in include/uapi/linux/kernel.h.
> So, it was exported to userspace.
> Kevin suspects 607ca46e97a1 ("UAPI: (Scripted) Disintegrate
> include/linux"), but I think the issue goes back more.
> I think the following is the first commit that exported it.
> Fixes: a79ff731a1b2 ("netfilter: xtables: make XT_ALIGN() usable in
> exported headers by exporting __ALIGN_KERNEL()")
Yes, that's the first commit which adds typeof().
I pointed out d6fc9fcbaa65, because that brought -std=c90. I thought that commit
introduced expectation of C without non-gnu extensions for headers. But if this
expectation was "since ever" then obviously a79ff731a1b2 is the faulty commit.
Anyway, I'm going to send patch, which replaces typeof() in
netfilter/x_tables.h.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-04-16 20:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12 0:24 + uapi-linux-consth-prefer-iso-friendly-__typeof__.patch added to mm-nonmm-unstable branch Andrew Morton
2023-04-12 1:33 ` Masahiro Yamada
2023-04-12 1:45 ` Andrew Morton
2023-04-12 5:34 ` Petr Vorel
2023-04-16 13:19 ` Masahiro Yamada
2023-04-16 20:54 ` Petr Vorel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.