From: Eric Biggers <ebiggers@kernel.org>
To: Boris Burkov <boris@bur.io>
Cc: linux-fscrypt@vger.kernel.org, linux-btrfs@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH v2] btrfs-progs: receive: add support for fs-verity
Date: Tue, 2 Aug 2022 13:41:44 -0700 [thread overview]
Message-ID: <YumMCGlxNWCV/k9G@sol.localdomain> (raw)
In-Reply-To: <e4789647b76c8b45c95256deed1cba583993b8b1.1659031931.git.boris@bur.io>
On Thu, Jul 28, 2022 at 11:14:35AM -0700, Boris Burkov wrote:
> +static int process_enable_verity(const char *path, u8 algorithm, u32 block_size,
> + int salt_len, char *salt,
> + int sig_len, char *sig, void *user)
> +{
> + int ret;
> + struct btrfs_receive *rctx = user;
> + char full_path[PATH_MAX];
> + struct fsverity_enable_arg verity_args = {
> + .version = 1,
> + .hash_algorithm = algorithm,
> + .block_size = block_size,
> + };
> + if (salt_len) {
> + verity_args.salt_size = salt_len;
> + verity_args.salt_ptr = (__u64)salt;
> + }
> + if (sig_len) {
> + verity_args.sig_size = sig_len;
> + verity_args.sig_ptr = (__u64)sig;
> + }
Casting a pointer to a __u64 needs to be done using (__u64)(uintptr_t),
otherwise it will cause a warning on 32-bit platforms.
> + /*
> + * Enabling verity denies write access, so it cannot be done with an
> + * open writeable file descriptor.
> + */
> + close_inode_for_write(rctx);
> + ret = ioctl(ioctl_fd, FS_IOC_ENABLE_VERITY, &verity_args);
> + if (ret < 0)
> + fprintf(stderr, "Failed to enable verity on %s: %d\n", full_path, ret);
Errors from ioctl() are returned in errno, not in the return value.
- Eric
prev parent reply other threads:[~2022-08-02 20:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 18:14 [PATCH v2] btrfs-progs: receive: add support for fs-verity Boris Burkov
2022-08-02 14:52 ` David Sterba
2022-08-02 20:41 ` Eric Biggers [this message]
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=YumMCGlxNWCV/k9G@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=boris@bur.io \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fscrypt@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