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]
Message-ID: <CACYkzJ4qpyP_tF+-AG6ukA1DLJJzV2xmaVO4r08bUMUCvOAT1g@mail.gmail.com>
Date:   Mon, 16 Nov 2020 15:49:08 +0100
From:   KP Singh <kpsingh@...omium.org>
To:     open list <linux-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Paul Turner <pjt@...gle.com>,
        Pauline Middelink <middelin@...gle.com>
Subject: Re: [PATCH bpf-next 2/2] bpf: Add tests for bpf_lsm_set_bprm_opts

[...]

> +
> +#include "vmlinux.h"
> +#include <errno.h>
> +#include <bpf/bpf_helpers.h>
> +#include <bpf/bpf_tracing.h>
> +
> +char _license[] SEC("license") = "GPL";
> +
> +struct {
> +       __uint(type, BPF_MAP_TYPE_TASK_STORAGE);
> +       __uint(map_flags, BPF_F_NO_PREALLOC);
> +       __type(key, int);
> +       __type(value, int);
> +} secure_exec_task_map SEC(".maps");
> +
> +SEC("lsm/bprm_creds_for_exec")
> +int BPF_PROG(secure_exec, struct linux_binprm *bprm)
> +{
> +       int *secureexec;
> +
> +       secureexec = bpf_task_storage_get(&secure_exec_task_map,
> +                                  bpf_get_current_task_btf(), 0,
> +                                  BPF_LOCAL_STORAGE_GET_F_CREATE);
> +       if (!secureexec)
> +               return 0;
> +
> +       if (*secureexec)
> +               bpf_lsm_set_bprm_opts(bprm, BPF_LSM_F_BPRM_SECUREEXEC);

This can just be:

       if (secureexec && *secureexec)
                  bpf_lsm_set_bprm_opts(bprm, BPF_LSM_F_BPRM_SECUREEXEC);

               bpf_lsm_set_bprm_opts(bprm, BPF_LSM_F_BPRM_SECUREEXEC);

> +       return 0;
> +}
> --
> 2.29.2.299.gdc1121823c-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ