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>] [day] [month] [year] [list]
Message-ID: <HK0PR02MB2563952EA994718C6B34DAC7AB9A0@HK0PR02MB2563.apcprd02.prod.outlook.com>
Date:   Wed, 17 Jun 2020 03:55:11 +0000
From:   陈安庆 <chenanqing@...o.com>
To:     Miklos Szeredi <miklos@...redi.hu>
CC:     "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: about the fuse code question,maybe a bug

Dear Miklos

    Hi ,I read the fuse code in linux kernel,and I have some question about the code blow:

static int fuse_read_interrupt(struct fuse_iqueue *fiq,
                               struct fuse_copy_state *cs,
                               size_t nbytes, struct fuse_req *req)
__releases(fiq->lock)
{
        struct fuse_in_header ih;
        struct fuse_interrupt_in arg;
        unsigned reqsize = sizeof(ih) + sizeof(arg);
        int err;

        list_del_init(&req->intr_entry);
        memset(&ih, 0, sizeof(ih));
        memset(&arg, 0, sizeof(arg));
        ih.len = reqsize;
        ih.opcode = FUSE_INTERRUPT;
        ih.unique = (req->in.h.unique | FUSE_INT_REQ_BIT);
        arg.unique = req->in.h.unique;

        spin_unlock(&fiq->lock);
        if (nbytes < reqsize)
                return -EINVAL;

        err = fuse_copy_one(cs, &ih, sizeof(ih));-------------------------here is my question
        if (!err)--------------------------------------------------------------------if copy success ,why should copy again?
                err = fuse_copy_one(cs, &arg, sizeof(arg));
        fuse_copy_finish(cs);

        return err ? err : reqsize;
}

because fuse_copy_one return zero when copy is ok,why should we copy again with " err = fuse_copy_one(cs, &arg, sizeof(arg));"??

if we copy again,we changed the " ih.opcode = FUSE_INTERRUPT;" logic,
,we maybe enter a cycle because the libfuse code is blow:

if (in->opcode != FUSE_INTERRUPT) {
                struct fuse_req *intr;
                pthread_mutex_lock(&f->lock);
                intr = check_interrupt(f, req);
                list_add_req(req, &f->list);
                pthread_mutex_unlock(&f->lock);
                if (intr)
                        fuse_reply_err(intr, EAGAIN);
        }

we need the opcode to be FUSE_INTERRUPT if we had been interrupted .


so the request be queued in the list again and again.

my stap result is blew:
call queue_interrupt,req->intr_unique=150414567,waiting=1,state=3,req=ffff972dc11bb9d0
 0xffffffffc0956390 : queue_interrupt+0x0/0x60 [fuse]
 0xffffffffc095934e : fuse_dev_do_write+0x3ae/0x3f0 [fuse]
 0xffffffffacb6f439 : kretprobe_trampoline+0x0/0x57 [kernel]
enter 1876,num=150414567,error=-11,fc->dev=40
call queue_interrupt,req->intr_unique=150414569,waiting=1,state=3,req=ffff972dc11bb9d0
 0xffffffffc0956390 : queue_interrupt+0x0/0x60 [fuse]
 0xffffffffc095934e : fuse_dev_do_write+0x3ae/0x3f0 [fuse]
 0xffffffffacb6f439 : kretprobe_trampoline+0x0/0x57 [kernel]
enter 1876,num=150414569,error=-11,fc->dev=40
call queue_interrupt,req->intr_unique=150414571,waiting=1,state=3,req=ffff972dc11bb9d0
 0xffffffffc0956390 : queue_interrupt+0x0/0x60 [fuse]
 0xffffffffc095934e : fuse_dev_do_write+0x3ae/0x3f0 [fuse]
 0xffffffffacb6f439 : kretprobe_trampoline+0x0/0x57 [kernel]
enter 1876,num=150414571,error=-11,fc->dev=40

every time I look the request , it is the same id:

crash> fuse_req.interrupted,state,intr_unique,in.h.opcode,in.h.pid,in.h.unique ffff972dc11bb9d0
  interrupted = 1
  state = FUSE_REQ_SENT
  intr_unique = 151651490
  in.h.opcode = 14,
  in.h.pid = 144993,
  in.h.unique = 26744801,
crash> fuse_req.interrupted,state,intr_unique,in.h.opcode,in.h.pid,in.h.unique ffff972dc11bb9d0
  interrupted = 1
  state = FUSE_REQ_SENT
  intr_unique = 151651535--------------only the  intr_unique value been changed
  in.h.opcode = 14,
  in.h.pid = 144993,
  in.h.unique = 26744801,


and I'm very sure the task 144993 nerver been scheduled .
cat /proc/144993/status |grep switches && sleep 10 && cat /proc/144993/status |grep switches
voluntary_ctxt_switches:260012
nonvoluntary_ctxt_switches:1592
voluntary_ctxt_switches:260012
nonvoluntary_ctxt_switches:1592

the task is been "State:D (disk sleep)" all the time .

maybe I can provide a patch ,I need your reply ,thankyou very much.

________________________________
OPPO

本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。

This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ