lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 3 Feb 2015 20:22:59 +0100
From:	Robert Swiecki <swiecki@...gle.com>
To:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] samples/seccomp: improve label helper

2015-02-03 19:56 GMT+01:00 Kees Cook <keescook@...omium.org>:

> Fixes a potential corruption with uninitialized stack memory in the seccomp
> BPF sample program.
>
> Reported-by: Robert Swiecki <swiecki@...gle.com>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
>  samples/seccomp/bpf-fancy.c  | 4 +++-
>  samples/seccomp/bpf-helper.c | 5 +++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/samples/seccomp/bpf-fancy.c b/samples/seccomp/bpf-fancy.c
> index 8eb483aaec46..e8b24f443709 100644
> --- a/samples/seccomp/bpf-fancy.c
> +++ b/samples/seccomp/bpf-fancy.c
> @@ -25,7 +25,9 @@
>
>  int main(int argc, char **argv)
>  {
> -       struct bpf_labels l;
> +       struct bpf_labels l = {
> +               .count = 0,
> +       };
>         static const char msg1[] = "Please type something: ";
>         static const char msg2[] = "You typed: ";
>         char buf[256];
> diff --git a/samples/seccomp/bpf-helper.c b/samples/seccomp/bpf-helper.c
> index 579cfe331886..f9fa14d81798 100644
> --- a/samples/seccomp/bpf-helper.c
> +++ b/samples/seccomp/bpf-helper.c
> @@ -10,6 +10,7 @@
>   */
>
>  #include <stdio.h>
> +#include <stdlib.h>
>  #include <string.h>
>
>  #include "bpf-helper.h"
> @@ -63,6 +64,10 @@ __u32 seccomp_bpf_label(struct bpf_labels *labels, const char *label)
>  {
>         struct __bpf_label *begin = labels->labels, *end;
>         int id;
> +       if (labels->count == BPF_LABELS_MAX) {
> +               fprintf(stderr, "Too many labels\n");
> +               exit(1);
> +       }
>         if (labels->count == 0) {
>                 begin->label = label;
>                 begin->location = 0xffffffff;
> --
> 1.9.1
>
>
> --
> Kees Cook
> Chrome OS Security

Hi,

Thanks for the patch!

Not sure if we care, but with a more strict warning/error checking in
gcc I get now.

seccomp/bpf-helper.c:66:3: error: implicit declaration of function
‘exit’ [-Werror=implicit-function-declaration]
   exit(1);
   ^
seccomp/bpf-helper.c:66:3: error: incompatible implicit declaration of
built-in function ‘exit’ [-Werror]

-- 
Robert Święcki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ