From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <mirsad.todorovac@alu.unizg.hr>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<kuniyu@amazon.com>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>, <shuah@kernel.org>
Subject: Re: [BUG] selftests: af_unix: unix:diag.c does not compile on AlmaLinux 8.7
Date: Mon, 22 May 2023 09:28:43 -0700 [thread overview]
Message-ID: <20230522162843.49731-1-kuniyu@amazon.com> (raw)
In-Reply-To: <edac34c9-190c-0d80-8d95-2f42971cc870@alu.unizg.hr>
From: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Date: Mon, 22 May 2023 17:32:11 +0200
> Hi,
>
> On vanilla AlmaLinux 8.7 (CentOS fork) selftests/net/af_unix/diag_uid.c doesn't
> compile out of the box, giving the errors:
>
> make[2]: Entering directory '/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix'
> gcc diag_uid.c -o /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix/diag_uid
> diag_uid.c:36:16: error: ‘UDIAG_SHOW_UID’ undeclared here (not in a function); did you mean ‘UDIAG_SHOW_VFS’?
> .udiag_show = UDIAG_SHOW_UID
> ^~~~~~~~~~~~~~
> UDIAG_SHOW_VFS
> In file included from diag_uid.c:17:
> diag_uid.c: In function ‘render_response’:
> diag_uid.c:128:28: error: ‘UNIX_DIAG_UID’ undeclared (first use in this function); did you mean ‘UNIX_DIAG_VFS’?
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~~~~~
> ../../kselftest_harness.h:707:13: note: in definition of macro ‘__EXPECT’
> __typeof__(_seen) __seen = (_seen); \
> ^~~~~
> diag_uid.c:128:2: note: in expansion of macro ‘ASSERT_EQ’
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~
> diag_uid.c:128:28: note: each undeclared identifier is reported only once for each function it appears in
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~~~~~
> ../../kselftest_harness.h:707:13: note: in definition of macro ‘__EXPECT’
> __typeof__(_seen) __seen = (_seen); \
> ^~~~~
> diag_uid.c:128:2: note: in expansion of macro ‘ASSERT_EQ’
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~
> make[2]: *** [../../lib.mk:147: /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix/diag_uid] Error 1
>
> The correct value is in <uapi/linux/unix_diag.h>:
>
> include/uapi/linux/unix_diag.h:23:#define UDIAG_SHOW_UID 0x00000040 /* show socket's UID */
>
> The fix is as follows:
>
> ---
> tools/testing/selftests/net/af_unix/diag_uid.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/net/af_unix/diag_uid.c b/tools/testing/selftests/net/af_unix/diag_uid.c
> index 5b88f7129fea..66d75b646d35 100644
> --- a/tools/testing/selftests/net/af_unix/diag_uid.c
> +++ b/tools/testing/selftests/net/af_unix/diag_uid.c
> @@ -16,6 +16,10 @@
>
> #include "../../kselftest_harness.h"
>
> +#ifndef UDIAG_SHOW_UID
> +#define UDIAG_SHOW_UID 0x00000040 /* show socket's UID */
> +#endif
> +
> FIXTURE(diag_uid)
> {
> int netlink_fd;
>
> --
>
> However, this patch reveals another undefined value:
>
> make[2]: Entering directory '/home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix'
> gcc diag_uid.c -o /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix/diag_uid
> In file included from diag_uid.c:17:
> diag_uid.c: In function ‘render_response’:
> diag_uid.c:132:28: error: ‘UNIX_DIAG_UID’ undeclared (first use in this function); did you mean ‘UNIX_DIAG_VFS’?
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~~~~~
> ../../kselftest_harness.h:707:13: note: in definition of macro ‘__EXPECT’
> __typeof__(_seen) __seen = (_seen); \
> ^~~~~
> diag_uid.c:132:2: note: in expansion of macro ‘ASSERT_EQ’
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~
> diag_uid.c:132:28: note: each undeclared identifier is reported only once for each function it appears in
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~~~~~
> ../../kselftest_harness.h:707:13: note: in definition of macro ‘__EXPECT’
> __typeof__(_seen) __seen = (_seen); \
> ^~~~~
> diag_uid.c:132:2: note: in expansion of macro ‘ASSERT_EQ’
> ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
> ^~~~~~~~~
> make[2]: *** [../../lib.mk:147: /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix/diag_uid] Error 1
>
> Apparently, AlmaLinux 8.7 lacks this enum UNIX_DIAG_UID:
>
> diff -u /usr/include/linux/unix_diag.h include/uapi/linux/unix_diag.h
> --- /usr/include/linux/unix_diag.h 2023-05-16 13:47:51.000000000 +0200
> +++ include/uapi/linux/unix_diag.h 2022-10-12 07:35:58.253481367 +0200
> @@ -20,6 +20,7 @@
> #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */
> #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */
> #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */
> +#define UDIAG_SHOW_UID 0x00000040 /* show socket's UID */
>
> struct unix_diag_msg {
> __u8 udiag_family;
> @@ -40,6 +41,7 @@
> UNIX_DIAG_RQLEN,
> UNIX_DIAG_MEMINFO,
> UNIX_DIAG_SHUTDOWN,
> + UNIX_DIAG_UID,
>
> __UNIX_DIAG_MAX,
> };
>
> Now, this is a change in enums and there doesn't seem to an easy way out
> here. (I think I saw an example, but I cannot recall which thread. I will do
> more research.)
>
> When I included
>
> # gcc -I ../../../../include diag_uid.c
>
> I've got the following error:
>
> [marvin@pc-mtodorov linux_torvalds]$ cd tools/testing/selftests/net/af_unix/
> [marvin@pc-mtodorov af_unix]$ gcc -I ../../../../../include diag_uid.c -o
> /home/marvin/linux/kernel/linux_torvalds/tools/testing/selftests/net/af_unix/diag_uid
> In file included from ../../../../../include/linux/build_bug.h:5,
> from ../../../../../include/linux/bits.h:21,
> from ../../../../../include/linux/capability.h:18,
> from ../../../../../include/linux/netlink.h:6,
> from diag_uid.c:8:
> ../../../../../include/linux/compiler.h:246:10: fatal error: asm/rwonce.h: No such file or directory
> #include <asm/rwonce.h>
> ^~~~~~~~~~~~~~
> compilation terminated.
> [marvin@pc-mtodorov af_unix]$
>
> At this point I gave up, as it would be an overkill to change kernel system
> header to make a test pass, and this probably wouldn't be accepted upsteam?
>
> Hope this helps. (If we still want to build on CentOS/AlmaLinux/Rocky 8?)
I launched AlmaLinux/RockyLinux 8.7 and 9.2 with images listed in the pages
below.
https://wiki.almalinux.org/cloud/AWS.html#community-amis
https://rockylinux.org/cloud-images/
The kernel versions in each image were :
8.7:
Alma : 4.18.0-425.3.1.el8.x86_64
Rocky : 4.18.0-425.10.1.el8_7.x86_64
9.2:
Alma : 5.14.0-284.11.1.el9_2.x86_64
Rocky : 5.14.0-284.11.1.el9_2.x86_64
So, this is not a bug. It's just because v4.18 does not support
UNIX_DIAG_UID, which was introduced in v5.3.
You should install 5.3+ kernel if you want to build the test.
Thanks,
Kuniyuki
>
> Best regards,
> Mirsad
>
> --
> Mirsad Goran Todorovac
> Sistem inženjer
> Grafički fakultet | Akademija likovnih umjetnosti
> Sveučilište u Zagrebu
>
> System engineer
> Faculty of Graphic Arts | Academy of Fine Arts
> University of Zagreb, Republic of Croatia
next prev parent reply other threads:[~2023-05-22 16:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 15:32 [BUG] selftests: af_unix: unix:diag.c does not compile on AlmaLinux 8.7 Mirsad Todorovac
2023-05-22 16:28 ` Kuniyuki Iwashima [this message]
2023-05-22 18:01 ` Mirsad Goran Todorovac
2023-05-22 18:26 ` Kuniyuki Iwashima
2023-05-24 14:15 ` Mirsad Todorovac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230522162843.49731-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox