Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4756964rwe; Mon, 17 Apr 2023 18:44:50 -0700 (PDT) X-Google-Smtp-Source: AKy350aG5VhRzlIGFe5MZFzvhMDh09rQa+RiZQCXINF93N8PhpvG/zkWmgH5pGrMPL+Uns0XHvv6 X-Received: by 2002:a05:6a20:8ca9:b0:d5:73ad:87c2 with SMTP id k41-20020a056a208ca900b000d573ad87c2mr14276167pzh.56.1681782290619; Mon, 17 Apr 2023 18:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681782290; cv=none; d=google.com; s=arc-20160816; b=myhNsNLAdqctkUy9aNetpkXaTiAap4lL/rz2jYu8w2RH0xmDgtd4k5HqHum0RK7/vG Pp/KOvC2Nly9NOb3HxY74tEhLVj8NYJoLYd9XWou/AwyUBIc6a+fHN+ZROo3Pyv4IMyD TDonuh5lK+LgCB+lwLRzix8uAWI7IpptvhCvSS/Ac8O0PqWyE3wZ7jMosaRwFyu1drNM Ko4D3opkcXM8O5DkRnHw+IfHoj2FSZalB4CpNOoAeRVxkQmtYyrrNAWOcllgM/pLkUD4 OhqtEixsVW38+a4kSM9iBTmOk5iUTG7yzsxd2oUo/1MSoeVZ32ynx+TSVpZsiLdWrJvs DJGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=U2ap14iOZpnbsKNo6G93wf0F6NVTN36P+wrV7MWQ5vc=; b=ywgHcDvJQNoXqxdKPLdekDlxImAxAUdlZNrRJ11dNH9yEWznofpqqWtc7xHIqzP6LR S1P5UJ/h4Els54WKkT+860igcMa4oju+0mooEXHjXJZvtUHrctrvSWzn9kX0djB7UL3w lFqf7nMWfkQ84BhAnpalzo8/kKy3v/9blY1XOHJua/ShXi30Lrd60nVE53QnA/HLtxWr nFOBYAzdk+Hc/lTSQki/5HgXN79fmZbp6wJ1xeGRkVF6i5Vry6g11NtbfJ9x8j8Cpvk7 kpqxjjA2epHUI/MK/+YskCbERtJMHLbTPps65pc5uA8kRFKDxiSXywx9eTRhIoXBBFyQ 8EzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=LNB3R+49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b0050bef774fbfsi12246225pgb.838.2023.04.17.18.44.36; Mon, 17 Apr 2023 18:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=LNB3R+49; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231281AbjDRBoM (ORCPT + 99 others); Mon, 17 Apr 2023 21:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbjDRBm4 (ORCPT ); Mon, 17 Apr 2023 21:42:56 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF06883C1 for ; Mon, 17 Apr 2023 18:41:54 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-54f8b46f399so159472467b3.10 for ; Mon, 17 Apr 2023 18:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681782104; x=1684374104; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=U2ap14iOZpnbsKNo6G93wf0F6NVTN36P+wrV7MWQ5vc=; b=LNB3R+49gmQhyMAJnqmL6KYI/ZCR+tQ/0jba5N0/i2eEk6OmYIYbiuf0Z7V4bUldDj xmAcckNGdRp5IYqNUT8hqhpXD3vdnlrJNfoEzI9hjUpQNlq3IjGbbi4vQ1h9Xgp31A+R 5jbqBakdNiRAQFySaud23Qc2bb0XZCCsv91cuEDtJ0lsyZMTvQItKMyw0e1gbKSpBG7W 2yGprGFBTkg9LHUqY/Yx/LEu6jmWcorOClliwxzsxuu4MLRG7YazaQAJntomIhbXgBUg 9zw6XZJs07Ntzj/gIsAFey2DX1dvCDUPgQXl4rZCW29e5vOds9wU1NhA4cgwPQE9OmSr p62A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681782104; x=1684374104; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U2ap14iOZpnbsKNo6G93wf0F6NVTN36P+wrV7MWQ5vc=; b=Eok3LXURw1mogf10smAXs2ZYMniW7HxIk1ixxm+EwJ2+AnBPNZemmwK6riBvKR75Aa ZNMoy5ICtKeAnh6c2qNPlz6blTlFJ/fwH95pdsk3POf6xVAn4rFFPup85d+StA482qwJ wkyhV27HdWfixC7I4m9kn4yydhTAGVH31ecW/LD/QBhHMAlmRSa9pR74FyNfy9rOMDpW NCsBoPZDLrKw04u+k5+FWG+LneQqsNxV/xONh15SRIylk+OvRN15ioYNf1aUrVLvcCgZ QhhVaZsnpkD/UXs0jSyqBuhyL/eP2lY4rfYiAhIhPEHJfE3lu5afTMFGK6mJH7XwQZg6 fm4g== X-Gm-Message-State: AAQBX9dEKQDyXMpbnO7W8bN3p9hX1MeDXj0OTNlisHPmWkZGptqaU0X1 Irh/EU2FSmpL2/Jd3SYClVDRl5E3LmY= X-Received: from drosen.mtv.corp.google.com ([2620:15c:211:201:e67a:98b0:942d:86aa]) (user=drosen job=sendgmr) by 2002:a25:d196:0:b0:b8f:6faa:6480 with SMTP id i144-20020a25d196000000b00b8f6faa6480mr8469156ybg.7.1681782103829; Mon, 17 Apr 2023 18:41:43 -0700 (PDT) Date: Mon, 17 Apr 2023 18:40:23 -0700 In-Reply-To: <20230418014037.2412394-1-drosen@google.com> Mime-Version: 1.0 References: <20230418014037.2412394-1-drosen@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230418014037.2412394-24-drosen@google.com> Subject: [RFC PATCH v3 23/37] fuse-bpf: Add xattr support From: Daniel Rosenberg To: Miklos Szeredi , bpf@vger.kernel.org, Alexei Starovoitov Cc: Amir Goldstein , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Jonathan Corbet , Joanne Koong , Mykola Lysenko , kernel-team@android.com, Daniel Rosenberg , Paul Lawrence Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds support for FUSE_GETXATTR, FUSE_LISTXATTR, FUSE_SETXATTR, and FUSE_REMOVEXATTR Signed-off-by: Daniel Rosenberg Signed-off-by: Paul Lawrence --- fs/fuse/backing.c | 349 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/fuse_i.h | 30 ++++ fs/fuse/xattr.c | 18 +++ 3 files changed, 397 insertions(+) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 928b24db2303..eb3eb184c867 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -982,6 +982,355 @@ int fuse_bpf_dir_fsync(int *out, struct inode *inode, struct file *file, loff_t file, start, end, datasync); } +struct fuse_getxattr_args { + struct fuse_getxattr_in in; + struct fuse_buffer name; + struct fuse_buffer value; + struct fuse_getxattr_out out; +}; + +static int fuse_getxattr_initialize_in(struct bpf_fuse_args *fa, + struct fuse_getxattr_args *args, + struct dentry *dentry, const char *name, void *value, + size_t size) +{ + *args = (struct fuse_getxattr_args) { + .in.size = size, + .name = (struct fuse_buffer) { + .data = (void *) name, + .size = strlen(name) + 1, + .max_size = XATTR_NAME_MAX + 1, + .flags = BPF_FUSE_MUST_ALLOCATE | BPF_FUSE_VARIABLE_SIZE, + }, + }; + + *fa = (struct bpf_fuse_args) { + .info = (struct bpf_fuse_meta_info) { + .nodeid = get_fuse_inode(dentry->d_inode)->nodeid, + .opcode = FUSE_GETXATTR, + }, + .in_numargs = 2, + .in_args[0] = (struct bpf_fuse_arg) { + .size = sizeof(args->in), + .value = &args->in, + }, + .in_args[1] = (struct bpf_fuse_arg) { + .is_buffer = true, + .buffer = &args->name, + }, + }; + + return 0; +} + +static int fuse_getxattr_initialize_out(struct bpf_fuse_args *fa, + struct fuse_getxattr_args *args, + struct dentry *dentry, const char *name, void *value, + size_t size) +{ + fa->flags = size ? FUSE_BPF_OUT_ARGVAR : 0; + fa->out_numargs = 1; + if (size) { + args->value = (struct fuse_buffer) { + .data = (void *) value, + .size = size, + .alloc_size = size, + .max_size = size, + .flags = BPF_FUSE_VARIABLE_SIZE, + }; + fa->out_args[0].is_buffer = true; + fa->out_args[0].buffer = &args->value; + } else { + fa->out_args[0].size = sizeof(args->out); + fa->out_args[0].value = &args->out; + } + return 0; +} + +static int fuse_getxattr_backing(struct bpf_fuse_args *fa, int *out, + struct dentry *dentry, const char *name, void *value, + size_t size) +{ + ssize_t ret; + + if (fa->in_args[1].buffer->flags & BPF_FUSE_MODIFIED) { + // Ensure bpf provided string is null terminated + char *new_name = fa->in_args[1].buffer->data; + new_name[fa->in_args[1].buffer->size - 1] = 0; + } + ret = vfs_getxattr(&nop_mnt_idmap, + get_fuse_dentry(dentry)->backing_path.dentry, + fa->in_args[1].buffer->data, value, size); + + if (fa->flags & FUSE_BPF_OUT_ARGVAR) + fa->out_args[0].buffer->size = ret; + else + ((struct fuse_getxattr_out *)fa->out_args[0].value)->size = ret; + + return 0; +} + +static int fuse_getxattr_finalize(struct bpf_fuse_args *fa, int *out, + struct dentry *dentry, const char *name, void *value, + size_t size) +{ + struct fuse_getxattr_out *fgo; + + if (fa->flags & FUSE_BPF_OUT_ARGVAR) { + *out = fa->out_args[0].buffer->size; + return 0; + } + + fgo = fa->out_args[0].value; + + *out = fgo->size; + return 0; +} + +int fuse_bpf_getxattr(int *out, struct inode *inode, struct dentry *dentry, const char *name, + void *value, size_t size) +{ + return bpf_fuse_backing(inode, struct fuse_getxattr_args, out, + fuse_getxattr_initialize_in, fuse_getxattr_initialize_out, + fuse_getxattr_backing, fuse_getxattr_finalize, + dentry, name, value, size); +} + +static int fuse_listxattr_initialize_in(struct bpf_fuse_args *fa, + struct fuse_getxattr_args *args, + struct dentry *dentry, char *list, size_t size) +{ + *args = (struct fuse_getxattr_args) { + .in.size = size, + }; + + *fa = (struct bpf_fuse_args) { + .info = (struct bpf_fuse_meta_info) { + .nodeid = get_fuse_inode(dentry->d_inode)->nodeid, + .opcode = FUSE_LISTXATTR, + }, + .in_numargs = 1, + .in_args[0] = + (struct bpf_fuse_arg) { + .size = sizeof(args->in), + .value = &args->in, + }, + }; + + return 0; +} + +static int fuse_listxattr_initialize_out(struct bpf_fuse_args *fa, + struct fuse_getxattr_args *args, + struct dentry *dentry, char *list, size_t size) +{ + fa->out_numargs = 1; + + if (size) { + args->value = (struct fuse_buffer) { + .data = list, + .size = size, + .alloc_size = size, + .max_size = size, + .flags = BPF_FUSE_VARIABLE_SIZE, + }; + fa->flags = FUSE_BPF_OUT_ARGVAR; + fa->out_args[0].is_buffer = true; + fa->out_args[0].buffer = &args->value; + } else { + fa->out_args[0].size = sizeof(args->out); + fa->out_args[0].value = &args->out; + } + return 0; +} + +static int fuse_listxattr_backing(struct bpf_fuse_args *fa, ssize_t *out, struct dentry *dentry, + char *list, size_t size) +{ + *out = vfs_listxattr(get_fuse_dentry(dentry)->backing_path.dentry, list, size); + + if (*out < 0) + return *out; + + if (fa->flags & FUSE_BPF_OUT_ARGVAR) + fa->out_args[0].buffer->size = *out; + else + ((struct fuse_getxattr_out *)fa->out_args[0].value)->size = *out; + + return 0; +} + +static int fuse_listxattr_finalize(struct bpf_fuse_args *fa, ssize_t *out, struct dentry *dentry, + char *list, size_t size) +{ + struct fuse_getxattr_out *fgo; + + if (fa->info.error_in) + return 0; + + if (fa->flags & FUSE_BPF_OUT_ARGVAR) { + *out = fa->out_args[0].buffer->size; + return 0; + } + + fgo = fa->out_args[0].value; + *out = fgo->size; + return 0; +} + +int fuse_bpf_listxattr(ssize_t *out, struct inode *inode, struct dentry *dentry, + char *list, size_t size) +{ + return bpf_fuse_backing(inode, struct fuse_getxattr_args, out, + fuse_listxattr_initialize_in, fuse_listxattr_initialize_out, + fuse_listxattr_backing, fuse_listxattr_finalize, + dentry, list, size); +} + +struct fuse_setxattr_args { + struct fuse_setxattr_in in; + struct fuse_buffer name; + struct fuse_buffer value; +}; + +static int fuse_setxattr_initialize_in(struct bpf_fuse_args *fa, + struct fuse_setxattr_args *args, + struct dentry *dentry, const char *name, + const void *value, size_t size, int flags) +{ + *args = (struct fuse_setxattr_args) { + .in = (struct fuse_setxattr_in) { + .size = size, + .flags = flags, + }, + .name = (struct fuse_buffer) { + .data = (void *) name, + .size = strlen(name) + 1, + .max_size = XATTR_NAME_MAX + 1, + .flags = BPF_FUSE_VARIABLE_SIZE | BPF_FUSE_MUST_ALLOCATE, + }, + .value =(struct fuse_buffer) { + .data = (void *) value, + .size = size, + .max_size = XATTR_SIZE_MAX, + .flags = BPF_FUSE_VARIABLE_SIZE | BPF_FUSE_MUST_ALLOCATE, + }, + }; + + *fa = (struct bpf_fuse_args) { + .info = (struct bpf_fuse_meta_info) { + .nodeid = get_fuse_inode(dentry->d_inode)->nodeid, + .opcode = FUSE_SETXATTR, + }, + .in_numargs = 3, + .in_args[0] = (struct bpf_fuse_arg) { + .size = sizeof(args->in), + .value = &args->in, + }, + .in_args[1] = (struct bpf_fuse_arg) { + .is_buffer = true, + .buffer = &args->name, + }, + .in_args[2] = (struct bpf_fuse_arg) { + .is_buffer = true, + .buffer = &args->value, + }, + }; + + return 0; +} + +static int fuse_setxattr_initialize_out(struct bpf_fuse_args *fa, + struct fuse_setxattr_args *args, + struct dentry *dentry, const char *name, + const void *value, size_t size, int flags) +{ + return 0; +} + +static int fuse_setxattr_backing(struct bpf_fuse_args *fa, int *out, struct dentry *dentry, + const char *name, const void *value, size_t size, + int flags) +{ + // TODO Ensure we actually use filter values + *out = vfs_setxattr(&nop_mnt_idmap, + get_fuse_dentry(dentry)->backing_path.dentry, name, + value, size, flags); + return 0; +} + +static int fuse_setxattr_finalize(struct bpf_fuse_args *fa, int *out, struct dentry *dentry, + const char *name, const void *value, size_t size, + int flags) +{ + return 0; +} + +int fuse_bpf_setxattr(int *out, struct inode *inode, struct dentry *dentry, + const char *name, const void *value, size_t size, int flags) +{ + return bpf_fuse_backing(inode, struct fuse_setxattr_args, out, + fuse_setxattr_initialize_in, fuse_setxattr_initialize_out, + fuse_setxattr_backing, fuse_setxattr_finalize, + dentry, name, value, size, flags); +} + +static int fuse_removexattr_initialize_in(struct bpf_fuse_args *fa, + struct fuse_buffer *in, + struct dentry *dentry, const char *name) +{ + *in = (struct fuse_buffer) { + .data = (void *) name, + .size = strlen(name) + 1, + .max_size = XATTR_NAME_MAX + 1, + .flags = BPF_FUSE_VARIABLE_SIZE | BPF_FUSE_MUST_ALLOCATE, + }; + *fa = (struct bpf_fuse_args) { + .info = (struct bpf_fuse_meta_info) { + .nodeid = get_fuse_inode(dentry->d_inode)->nodeid, + .opcode = FUSE_REMOVEXATTR, + }, + .in_numargs = 1, + .in_args[0] = (struct bpf_fuse_arg) { + .is_buffer = true, + .buffer = in, + }, + }; + + return 0; +} + +static int fuse_removexattr_initialize_out(struct bpf_fuse_args *fa, + struct fuse_buffer *in, + struct dentry *dentry, const char *name) +{ + return 0; +} + +static int fuse_removexattr_backing(struct bpf_fuse_args *fa, int *out, + struct dentry *dentry, const char *name) +{ + struct path *backing_path = &get_fuse_dentry(dentry)->backing_path; + + /* TODO account for changes of the name by prefilter */ + *out = vfs_removexattr(&nop_mnt_idmap, backing_path->dentry, name); + return 0; +} + +static int fuse_removexattr_finalize(struct bpf_fuse_args *fa, int *out, + struct dentry *dentry, const char *name) +{ + return 0; +} + +int fuse_bpf_removexattr(int *out, struct inode *inode, struct dentry *dentry, const char *name) +{ + return bpf_fuse_backing(inode, struct fuse_buffer, out, + fuse_removexattr_initialize_in, fuse_removexattr_initialize_out, + fuse_removexattr_backing, fuse_removexattr_finalize, + dentry, name); +} + static inline void fuse_bpf_aio_put(struct fuse_bpf_aio_req *aio_req) { if (refcount_dec_and_test(&aio_req->ref)) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 74540f308636..243a8fe0c343 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1426,6 +1426,13 @@ int fuse_bpf_copy_file_range(ssize_t *out, struct inode *inode, struct file *fil size_t len, unsigned int flags); int fuse_bpf_fsync(int *out, struct inode *inode, struct file *file, loff_t start, loff_t end, int datasync); int fuse_bpf_dir_fsync(int *out, struct inode *inode, struct file *file, loff_t start, loff_t end, int datasync); +int fuse_bpf_getxattr(int *out, struct inode *inode, struct dentry *dentry, + const char *name, void *value, size_t size); +int fuse_bpf_listxattr(ssize_t *out, struct inode *inode, struct dentry *dentry, char *list, size_t size); +int fuse_bpf_setxattr(int *out, struct inode *inode, struct dentry *dentry, + const char *name, const void *value, size_t size, + int flags); +int fuse_bpf_removexattr(int *out, struct inode *inode, struct dentry *dentry, const char *name); int fuse_bpf_file_read_iter(ssize_t *out, struct inode *inode, struct kiocb *iocb, struct iov_iter *to); int fuse_bpf_file_write_iter(ssize_t *out, struct inode *inode, struct kiocb *iocb, struct iov_iter *from); int fuse_bpf_file_fallocate(int *out, struct inode *inode, struct file *file, int mode, loff_t offset, loff_t length); @@ -1520,6 +1527,29 @@ static inline int fuse_bpf_dir_fsync(int *out, struct inode *inode, struct file return 0; } +static inline int fuse_bpf_getxattr(int *out, struct inode *inode, struct dentry *dentry, + const char *name, void *value, size_t size) +{ + return 0; +} + +static inline int fuse_bpf_listxattr(ssize_t *out, struct inode *inode, struct dentry *dentry, char *list, size_t size) +{ + return 0; +} + +static inline int fuse_bpf_setxattr(int *out, struct inode *inode, struct dentry *dentry, + const char *name, const void *value, size_t size, + int flags) +{ + return 0; +} + +static inline int fuse_bpf_removexattr(int *out, struct inode *inode, struct dentry *dentry, const char *name) +{ + return 0; +} + static inline int fuse_bpf_file_read_iter(ssize_t *out, struct inode *inode, struct kiocb *iocb, struct iov_iter *to) { return 0; diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c index 49c01559580f..d00f7dc50038 100644 --- a/fs/fuse/xattr.c +++ b/fs/fuse/xattr.c @@ -118,6 +118,9 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size) if (fuse_is_bad(inode)) return -EIO; + if (fuse_bpf_listxattr(&ret, inode, entry, list, size)) + return ret; + if (!fuse_allow_current_process(fm->fc)) return -EACCES; @@ -182,9 +185,14 @@ static int fuse_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size) { + int err; + if (fuse_is_bad(inode)) return -EIO; + if (fuse_bpf_getxattr(&err, inode, dentry, name, value, size)) + return err; + return fuse_getxattr(inode, name, value, size); } @@ -194,9 +202,19 @@ static int fuse_xattr_set(const struct xattr_handler *handler, const char *name, const void *value, size_t size, int flags) { + int err; + bool handled; + if (fuse_is_bad(inode)) return -EIO; + if (value) + handled = fuse_bpf_setxattr(&err, inode, dentry, name, value, size, flags); + else + handled = fuse_bpf_removexattr(&err, inode, dentry, name); + if (handled) + return err; + if (!value) return fuse_removexattr(inode, name); -- 2.40.0.634.g4ca3ef3211-goog