[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190918100121.GB5088@elm>
Date: Wed, 18 Sep 2019 12:01:21 +0200
From: Tyler Hicks <tyhicks@...onical.com>
To: Christian Brauner <christian.brauner@...ntu.com>
Cc: keescook@...omium.org, luto@...capital.net, jannh@...gle.com,
wad@...omium.org, shuah@...nel.org, ast@...nel.org,
daniel@...earbox.net, kafai@...com, songliubraving@...com,
yhs@...com, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, Tycho Andersen <tycho@...ho.ws>,
stable@...r.kernel.org
Subject: Re: [PATCH 3/4] seccomp: avoid overflow in implicit constant
conversion
On 2019-09-18 10:48:32, Christian Brauner wrote:
> USER_NOTIF_MAGIC is assigned to int variables in this test so set it to INT_MAX
> to avoid warnings:
>
> seccomp_bpf.c: In function ‘user_notification_continue’:
> seccomp_bpf.c:3088:26: warning: overflow in implicit constant conversion [-Woverflow]
> #define USER_NOTIF_MAGIC 116983961184613L
> ^
> seccomp_bpf.c:3572:15: note: in expansion of macro ‘USER_NOTIF_MAGIC’
> resp.error = USER_NOTIF_MAGIC;
> ^~~~~~~~~~~~~~~~
>
> Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
> Signed-off-by: Christian Brauner <christian.brauner@...ntu.com>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Andy Lutomirski <luto@...capital.net>
> Cc: Will Drewry <wad@...omium.org>
> Cc: Shuah Khan <shuah@...nel.org>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Cc: Martin KaFai Lau <kafai@...com>
> Cc: Song Liu <songliubraving@...com>
> Cc: Yonghong Song <yhs@...com>
> Cc: Tycho Andersen <tycho@...ho.ws>
> CC: Tyler Hicks <tyhicks@...onical.com>
INT_MAX should be a safe value to use.
Reviewed-by: Tyler Hicks <tyhicks@...onical.com>
Tyler
> Cc: Jann Horn <jannh@...gle.com>
> Cc: stable@...r.kernel.org
> Cc: linux-kselftest@...r.kernel.org
> Cc: netdev@...r.kernel.org
> Cc: bpf@...r.kernel.org
> ---
> tools/testing/selftests/seccomp/seccomp_bpf.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index ee52eab01800..921f0e26f835 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -35,6 +35,7 @@
> #include <stdbool.h>
> #include <string.h>
> #include <time.h>
> +#include <limits.h>
> #include <linux/elf.h>
> #include <sys/uio.h>
> #include <sys/utsname.h>
> @@ -3080,7 +3081,7 @@ static int user_trap_syscall(int nr, unsigned int flags)
> return seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog);
> }
>
> -#define USER_NOTIF_MAGIC 116983961184613L
> +#define USER_NOTIF_MAGIC INT_MAX
> TEST(user_notification_basic)
> {
> pid_t pid;
> --
> 2.23.0
>
Powered by blists - more mailing lists