linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: serge@hallyn.com (Serge E. Hallyn)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 1/9] cap_file: use v3 xattr macros
Date: Mon, 13 Aug 2018 11:11:11 -0500	[thread overview]
Message-ID: <20180813161111.GA26763@mail.hallyn.com> (raw)
In-Reply-To: <20180810161335.27036-2-christian@brauner.io>

Quoting Christian Brauner (christian at brauner.io):
> On kernels supporting VFS_CAP_REVISION_3 we should make use the new
> macros.
> 
> Signed-off-by: Christian Brauner <christian@brauner.io>
> Reviewed-by: Serge Hallyn <serge@hallyn.com>

Hi Andrew,

are you open to taking this patchset (or one like it) in
libcap2?

thanks,
-serge

> ---
>  libcap/cap_file.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/libcap/cap_file.c b/libcap/cap_file.c
> index 76aac8c..228d806 100644
> --- a/libcap/cap_file.c
> +++ b/libcap/cap_file.c
> @@ -59,6 +59,13 @@ static cap_t _fcaps_load(struct vfs_cap_data *rawvfscap, cap_t result,
>  	break;
>  #endif
>  
> +#ifdef VFS_CAP_REVISION_3
> +    case VFS_CAP_REVISION_3:
> +	tocopy = VFS_CAP_U32_3;
> +	bytes -= XATTR_CAPS_SZ_3;
> +	break;
> +#endif
> +
>      default:
>  	cap_free(result);
>  	result = NULL;
> @@ -125,9 +132,15 @@ static int _fcaps_save(struct vfs_cap_data *rawvfscap, cap_t cap_d,
>  
>  #ifdef _LINUX_CAPABILITY_VERSION_3
>      case _LINUX_CAPABILITY_VERSION_3:
> +#ifdef VFS_CAP_REVISION_3
> +	magic = VFS_CAP_REVISION_3;
> +	tocopy = VFS_CAP_U32_3;
> +	*bytes_p = XATTR_CAPS_SZ_3;
> +#else
>  	magic = VFS_CAP_REVISION_2;
>  	tocopy = VFS_CAP_U32_2;
>  	*bytes_p = XATTR_CAPS_SZ_2;
> +#endif
>  	break;
>  #endif
>  
> -- 
> 2.17.1

  reply	other threads:[~2018-08-13 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 16:13 [PATCH 0/9] libcap: add user namespace fscaps support Christian Brauner
2018-08-10 16:13 ` [PATCH 1/9] cap_file: use v3 xattr macros Christian Brauner
2018-08-13 16:11   ` Serge E. Hallyn [this message]
2018-08-10 16:13 ` [PATCH 2/9] capability: update to new uapi header Christian Brauner
2018-08-10 16:13 ` [PATCH 3/9] cap_file: use struct vfs_ns_cap_data if possible Christian Brauner
2018-08-10 16:13 ` [PATCH 4/9] cap_file: add new rootid argument Christian Brauner
2018-08-10 16:13 ` [PATCH 5/9] cap_file: initialize rootid in _fcaps_load() Christian Brauner
2018-08-10 16:13 ` [PATCH 6/9] capability: add cap_get_nsowner() Christian Brauner
2018-08-10 16:13 ` [PATCH 7/9] cap_file: save rootid in _fcaps_save() Christian Brauner
2018-08-10 16:13 ` [PATCH 8/9] cap_file: handle run- vs buildtime vfs cap support Christian Brauner
2018-08-10 16:13 ` [PATCH 9/9] capability: add cap_set_nsowner() Christian Brauner

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=20180813161111.GA26763@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=linux-security-module@vger.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;
as well as URLs for NNTP newsgroup(s).