17 Aug, 2022

5 commits

  • [ Upstream commit aa7aeee169480e98cf41d83c01290a37e569be6d ]

    Ensure that the fid's iounit field is set to zero when a new fid is
    created. Certain 9P operations, such as OPEN and CREATE, allow the
    server to reply with an iounit size which the client code assigns to the
    p9_fid struct shortly after the fid is created by p9_fid_create(). On
    the other hand, an XATTRWALK operation doesn't allow for the server to
    specify an iounit value. The iounit field of the newly allocated p9_fid
    struct remained uninitialized in that case. Depending on allocation
    patterns, the iounit value could have been something reasonable that was
    carried over from previously freed fids or, in the worst case, could
    have been arbitrary values from non-fid related usages of the memory
    location.

    The bug was detected in the Windows Subsystem for Linux 2 (WSL2) kernel
    after the uninitialized iounit field resulted in the typical sequence of
    two getxattr(2) syscalls, one to get the size of an xattr and another
    after allocating a sufficiently sized buffer to fit the xattr value, to
    hit an unexpected ERANGE error in the second call to getxattr(2). An
    uninitialized iounit field would sometimes force rsize to be smaller
    than the xattr value size in p9_client_read_once() and the 9P server in
    WSL refused to chunk up the READ on the attr_fid and, instead, returned
    ERANGE to the client. The virtfs server in QEMU seems happy to chunk up
    the READ and this problem goes undetected there.

    Link: https://lkml.kernel.org/r/20220710141402.803295-1-tyhicks@linux.microsoft.com
    Fixes: ebf46264a004 ("fs/9p: Add support user. xattr")
    Cc: stable@vger.kernel.org
    Signed-off-by: Tyler Hicks
    Reviewed-by: Christian Schoenebeck
    Signed-off-by: Dominique Martinet
    Signed-off-by: Sasha Levin

    Tyler Hicks
     
  • [ Upstream commit 4ac7573e1f9333073fa8d303acc941c9b7ab7f61 ]

    p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid
    temporary refcount leak.

    Link: https://lkml.kernel.org/r/20220712104438.30800-1-hbh25y@gmail.com
    Fixes: 728356dedeff ("9p: Add refcount to p9_req_t")
    Signed-off-by: Hangyu Hua
    [Dominique: commit wording adjustments, p9_req_put argument fixes for rebase]
    Signed-off-by: Dominique Martinet
    Signed-off-by: Sasha Levin

    Hangyu Hua
     
  • [ Upstream commit 8b11ff098af42b1fa57fc817daadd53c8b244a0c ]

    This is to aid in adding mempools, in the next patch.

    Link: https://lkml.kernel.org/r/20220704014243.153050-2-kent.overstreet@gmail.com
    Signed-off-by: Kent Overstreet
    Cc: Eric Van Hensbergen
    Cc: Latchesar Ionkov
    Signed-off-by: Dominique Martinet
    Signed-off-by: Sasha Levin

    Kent Overstreet
     
  • [ Upstream commit 6cda12864cb0f99810a5809e11e3ee5b102c9a47 ]

    An upcoming patch is going to require passing the client through
    p9_req_put() -> p9_req_free(), but that's awkward with the kref
    indirection - so this patch switches to using refcount_t directly.

    Link: https://lkml.kernel.org/r/20220704014243.153050-1-kent.overstreet@gmail.com
    Signed-off-by: Kent Overstreet
    Cc: Eric Van Hensbergen
    Cc: Latchesar Ionkov
    Signed-off-by: Dominique Martinet
    Signed-off-by: Sasha Levin

    Kent Overstreet
     
  • [ Upstream commit 6e195b0f7c8e50927fa31946369c22a0534ec7e2 ]

    Sohaib Mohamed started a serie of tiny and incomplete checkpatch fixes but
    seemingly stopped halfway -- take over and do most of it.
    This is still missing net/9p/trans* and net/9p/protocol.c for a later
    time...

    Link: http://lkml.kernel.org/r/20211102134608.1588018-3-dominique.martinet@atmark-techno.com
    Signed-off-by: Dominique Martinet
    Signed-off-by: Sasha Levin

    Dominique Martinet
     

11 Mar, 2022

1 commit

  • Commit 5cadd4bb1d7fc9ab201ac14620d1a478357e4ebd upstream.

    Instead of __get_free_pages() and free_pages() use alloc_pages_exact()
    and free_pages_exact(). This is in preparation of a change of
    gnttab_end_foreign_access() which will prohibit use of high-order
    pages.

    By using the local variable "order" instead of ring->intf->ring_order
    in the error path of xen_9pfs_front_alloc_dataring() another bug is
    fixed, as the error path can be entered before ring->intf->ring_order
    is being set.

    By using alloc_pages_exact() the size in bytes is specified for the
    allocation, which fixes another bug for the case of
    order < (PAGE_SHIFT - XEN_PAGE_SHIFT).

    This is part of CVE-2022-23041 / XSA-396.

    Reported-by: Simon Gaiser
    Signed-off-by: Juergen Gross
    Reviewed-by: Jan Beulich
    Signed-off-by: Greg Kroah-Hartman

    Juergen Gross
     

19 Nov, 2021

1 commit


05 Sep, 2021

3 commits

  • Let's raise the default msize value to 128k.

    The 'msize' option defines the maximum message size allowed for any
    message being transmitted (in both directions) between 9p server and 9p
    client during a 9p session.

    Currently the default 'msize' is just 8k, which is way too conservative.
    Such a small 'msize' value has quite a negative performance impact,
    because individual 9p messages have to be split up far too often into
    numerous smaller messages to fit into this message size limitation.

    A default value of just 8k also has a much higher probablity of hitting
    short-read issues like: https://gitlab.com/qemu-project/qemu/-/issues/409

    Unfortunately user feedback showed that many 9p users are not aware that
    this option even exists, nor the negative impact it might have if it is
    too low.

    Link: http://lkml.kernel.org/r/61ea0f0faaaaf26dd3c762eabe4420306ced21b9.1630770829.git.linux_oss@crudebyte.com
    Link: https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg01003.html
    Signed-off-by: Christian Schoenebeck
    Signed-off-by: Dominique Martinet

    Christian Schoenebeck
     
  • Use a macro to define the default value for the 'msize' option
    at one place instead of using two separate integer literals.

    Link: http://lkml.kernel.org/r/28bb651ae0349a7d57e8ddc92c1bd5e62924a912.1630770829.git.linux_oss@crudebyte.com
    Signed-off-by: Christian Schoenebeck
    Signed-off-by: Dominique Martinet

    Christian Schoenebeck
     
  • Historically TCP has been limited to 64K buffers, but increasing
    msize provides huge performance benefits especially as latency
    increase so allow for bigger buffers.

    Ideally further improvements could change the allocation from the
    current contiguous chunk in slab (kmem_cache) to some scatter-gather
    compatible API...

    Note this only increases the max possible setting, not the default
    value.

    Link: http://lkml.kernel.org/r/YTQB5jCbvhmCWzNd@codewreck.org
    Signed-off-by: Dominique Martinet

    Dominique Martinet
     

27 Jul, 2021

2 commits

  • This patch addresses the following problems:
    - priv can never be NULL, so this part of the check is useless
    - if the loop ran through the whole list, priv->client is invalid and
    it is more appropriate and sufficient to check for the end of
    list_for_each_entry loop condition.

    Link: http://lkml.kernel.org/r/20210727000709.225032-1-harshvardhan.jha@oracle.com
    Signed-off-by: Harshvardhan Jha
    Reviewed-by: Stefano Stabellini
    Tested-by: Stefano Stabellini
    Cc:
    Signed-off-by: Dominique Martinet

    Harshvardhan Jha
     
  • This ensures we don't leak the sysfs file if we failed to
    allocate chan->vc_wq during probe.

    Link: http://lkml.kernel.org/r/20210517083557.172-1-xieyongji@bytedance.com
    Fixes: 86c8437383ac ("net/9p: Add sysfs mount_tag file for virtio 9P device")
    Signed-off-by: Xie Yongji
    Signed-off-by: Dominique Martinet

    Xie Yongji
     

03 Jun, 2021

1 commit


29 Mar, 2021

3 commits


04 Mar, 2021

1 commit

  • I met below warning when cating a small size(about 80bytes) txt file
    on 9pfs(msize=2097152 is passed to 9p mount option), the reason is we
    miss iov_iter_advance() if the read count is 0 for zerocopy case, so
    we didn't truncate the pipe, then iov_iter_pipe() thinks the pipe is
    full. Fix it by removing the exception for 0 to ensure to call
    iov_iter_advance() even on empty read for zerocopy case.

    [ 8.279568] WARNING: CPU: 0 PID: 39 at lib/iov_iter.c:1203 iov_iter_pipe+0x31/0x40
    [ 8.280028] Modules linked in:
    [ 8.280561] CPU: 0 PID: 39 Comm: cat Not tainted 5.11.0+ #6
    [ 8.281260] RIP: 0010:iov_iter_pipe+0x31/0x40
    [ 8.281974] Code: 2b 42 54 39 42 5c 76 22 c7 07 20 00 00 00 48 89 57 18 8b 42 50 48 c7 47 08 b
    [ 8.283169] RSP: 0018:ffff888000cbbd80 EFLAGS: 00000246
    [ 8.283512] RAX: 0000000000000010 RBX: ffff888000117d00 RCX: 0000000000000000
    [ 8.283876] RDX: ffff88800031d600 RSI: 0000000000000000 RDI: ffff888000cbbd90
    [ 8.284244] RBP: ffff888000cbbe38 R08: 0000000000000000 R09: ffff8880008d2058
    [ 8.284605] R10: 0000000000000002 R11: ffff888000375510 R12: 0000000000000050
    [ 8.284964] R13: ffff888000cbbe80 R14: 0000000000000050 R15: ffff88800031d600
    [ 8.285439] FS: 00007f24fd8af600(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000
    [ 8.285844] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 8.286150] CR2: 00007f24fd7d7b90 CR3: 0000000000c97000 CR4: 00000000000406b0
    [ 8.286710] Call Trace:
    [ 8.288279] generic_file_splice_read+0x31/0x1a0
    [ 8.289273] ? do_splice_to+0x2f/0x90
    [ 8.289511] splice_direct_to_actor+0xcc/0x220
    [ 8.289788] ? pipe_to_sendpage+0xa0/0xa0
    [ 8.290052] do_splice_direct+0x8b/0xd0
    [ 8.290314] do_sendfile+0x1ad/0x470
    [ 8.290576] do_syscall_64+0x2d/0x40
    [ 8.290818] entry_SYSCALL_64_after_hwframe+0x44/0xa9
    [ 8.291409] RIP: 0033:0x7f24fd7dca0a
    [ 8.292511] Code: c3 0f 1f 80 00 00 00 00 4c 89 d2 4c 89 c6 e9 bd fd ff ff 0f 1f 44 00 00 31 8
    [ 8.293360] RSP: 002b:00007ffc20932818 EFLAGS: 00000206 ORIG_RAX: 0000000000000028
    [ 8.293800] RAX: ffffffffffffffda RBX: 0000000001000000 RCX: 00007f24fd7dca0a
    [ 8.294153] RDX: 0000000000000000 RSI: 0000000000000003 RDI: 0000000000000001
    [ 8.294504] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
    [ 8.294867] R10: 0000000001000000 R11: 0000000000000206 R12: 0000000000000003
    [ 8.295217] R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000000
    [ 8.295782] ---[ end trace 63317af81b3ca24b ]---

    Signed-off-by: Jisheng Zhang
    Signed-off-by: David S. Miller

    Jisheng Zhang
     

28 Jan, 2021

1 commit

  • These Kconfig files are included from net/Kconfig, inside the
    if NET ... endif.

    Remove 'depends on NET', which we know it is already met.

    Signed-off-by: Masahiro Yamada
    Link: https://lore.kernel.org/r/20210125232026.106855-1-masahiroy@kernel.org
    Signed-off-by: Jakub Kicinski

    Masahiro Yamada
     

22 Dec, 2020

1 commit

  • Pull 9p update from Dominique Martinet:

    - fix long-standing limitation on open-unlink-fop pattern

    - add refcount to p9_fid (fixes the above and will allow for more
    cleanups and simplifications in the future)

    * tag '9p-for-5.11-rc1' of git://github.com/martinetd/linux:
    9p: Remove unnecessary IS_ERR() check
    9p: Uninitialized variable in v9fs_writeback_fid()
    9p: Fix writeback fid incorrectly being attached to dentry
    9p: apply review requests for fid refcounting
    9p: add refcount to p9_fid struct
    fs/9p: search open fids first
    fs/9p: track open fids
    fs/9p: fix create-unlink-getattr idiom

    Linus Torvalds
     

20 Nov, 2020

2 commits

  • Fix style issues in parent commit ("apply review requests for fid
    refcounting"), no functional change.

    Link: http://lkml.kernel.org/r/1605802012-31133-2-git-send-email-asmadeus@codewreck.org
    Fixes: 6636b6dcc3db ("9p: add refcount to p9_fid struct")
    Signed-off-by: Dominique Martinet

    Dominique Martinet
     
  • Fix race issue in fid contention.

    Eric's and Greg's patch offer a mechanism to fix open-unlink-f*syscall
    bug in 9p. But there is race issue in fid parallel accesses.
    As Greg's patch stores all of fids from opened files into according inode,
    so all the lookup fid ops can retrieve fid from inode preferentially. But
    there is no mechanism to handle the fid contention issue. For example,
    there are two threads get the same fid in the same time and one of them
    clunk the fid before the other thread ready to discard the fid. In this
    scenario, it will lead to some fatal problems, even kernel core dump.

    I introduce a mechanism to fix this race issue. A counter field introduced
    into p9_fid struct to store the reference counter to the fid. When a fid
    is allocated from the inode or dentry, the counter will increase, and
    will decrease at the end of its occupation. It is guaranteed that the
    fid won't be clunked before the reference counter go down to 0, then
    we can avoid the clunked fid to be used.

    tests:
    race issue test from the old test case:
    for file in {01..50}; do touch f.${file}; done
    seq 1 1000 | xargs -n 1 -P 50 -I{} cat f.* > /dev/null

    open-unlink-f*syscall test:
    I have tested for f*syscall include: ftruncate fstat fchown fchmod faccessat.

    Link: http://lkml.kernel.org/r/20200923141146.90046-5-jianyong.wu@arm.com
    Fixes: 478ba09edc1f ("fs/9p: search open fids first")
    Signed-off-by: Jianyong Wu
    Signed-off-by: Dominique Martinet

    Jianyong Wu
     

03 Nov, 2020

2 commits

  • Fixes several outstanding bug reports of not being able to getattr from an
    open file after an unlink. This patch cleans up transient fids on an unlink
    and will search open fids on a client if it detects a dentry that appears to
    have been unlinked. This search is necessary because fstat does not pass fd
    information through the VFS API to the filesystem, only the dentry which for
    9p has an imperfect match to fids.

    Inherent in this patch is also a fix for the qid handling on create/open
    which apparently wasn't being set correctly and was necessary for the search
    to succeed.

    A possible optimization over this fix is to include accounting of open fids
    with the inode in the private data (in a similar fashion to the way we track
    transient fids with dentries). This would allow a much quicker search for
    a matching open fid.

    (changed v9fs_fid_find_global to v9fs_fid_find_inode in comment)

    Link: http://lkml.kernel.org/r/20200923141146.90046-2-jianyong.wu@arm.com
    Signed-off-by: Eric Van Hensbergen
    Signed-off-by: Greg Kurz
    Signed-off-by: Jianyong Wu
    Signed-off-by: Dominique Martinet

    Eric Van Hensbergen
     
  • net/9p/client.c:420: warning: Function parameter or member 'c' not described in 'p9_client_cb'
    net/9p/client.c:420: warning: Function parameter or member 'req' not described in 'p9_client_cb'
    net/9p/client.c:420: warning: Function parameter or member 'status' not described in 'p9_client_cb'
    net/9p/client.c:568: warning: Function parameter or member 'uidata' not described in 'p9_check_zc_errors'
    net/9p/trans_common.c:23: warning: Function parameter or member 'nr_pages' not described in 'p9_release_pages'
    net/9p/trans_common.c:23: warning: Function parameter or member 'pages' not described in 'p9_release_pages'
    net/9p/trans_fd.c:132: warning: Function parameter or member 'rreq' not described in 'p9_conn'
    net/9p/trans_fd.c:132: warning: Function parameter or member 'wreq' not described in 'p9_conn'
    net/9p/trans_fd.c:56: warning: Function parameter or member 'privport' not described in 'p9_fd_opts'
    net/9p/trans_rdma.c:113: warning: Function parameter or member 'cqe' not described in 'p9_rdma_context'
    net/9p/trans_rdma.c:129: warning: Function parameter or member 'privport' not described in 'p9_rdma_opts'
    net/9p/trans_virtio.c:215: warning: Function parameter or member 'limit' not described in 'pack_sg_list_p'
    net/9p/trans_virtio.c:83: warning: Function parameter or member 'chan_list' not described in 'virtio_chan'
    net/9p/trans_virtio.c:83: warning: Function parameter or member 'p9_max_pages' not described in 'virtio_chan'
    net/9p/trans_virtio.c:83: warning: Function parameter or member 'ring_bufs_avail' not described in 'virtio_chan'
    net/9p/trans_virtio.c:83: warning: Function parameter or member 'tag' not described in 'virtio_chan'
    net/9p/trans_virtio.c:83: warning: Function parameter or member 'vc_wq' not described in 'virtio_chan'

    Signed-off-by: Andrew Lunn
    Acked-by: Dominique Martinet
    Link: https://lore.kernel.org/r/20201031182655.1082065-1-andrew@lunn.ch
    Signed-off-by: Jakub Kicinski

    Andrew Lunn
     

12 Oct, 2020

1 commit

  • In p9_fd_create_unix, checking is performed to see if the addr (passed
    as an argument) is NULL or not.
    However, no check is performed to see if addr is a valid address, i.e.,
    it doesn't entirely consist of only 0's.
    The initialization of sun_server.sun_path to be equal to this faulty
    addr value leads to an uninitialized variable, as detected by KMSAN.
    Checking for this (faulty addr) and returning a negative error number
    appropriately, resolves this issue.

    Link: http://lkml.kernel.org/r/20201012042404.2508-1-anant.thazhemadam@gmail.com
    Reported-by: syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com
    Tested-by: syzbot+75d51fe5bf4ebe988518@syzkaller.appspotmail.com
    Signed-off-by: Anant Thazhemadam
    Signed-off-by: Dominique Martinet

    Anant Thazhemadam
     

09 Oct, 2020

1 commit

  • Fix follow warnings:
    [net/9p/trans_xen.c:454]: (warning) %u in format string (no. 1) requires
    'unsigned int' but the argument type is 'int'.
    [net/9p/trans_xen.c:460]: (warning) %u in format string (no. 1) requires
    'unsigned int' but the argument type is 'int'.

    Link: http://lkml.kernel.org/r/20201009080552.89918-1-yebin10@huawei.com
    Reported-by: Hulk Robot
    Signed-off-by: Ye Bin
    Signed-off-by: Dominique Martinet

    Ye Bin
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

15 Aug, 2020

1 commit

  • Pull 9p updates from Dominique Martinet:

    - some code cleanup

    - a couple of static analysis fixes

    - setattr: try to pick a fid associated with the file rather than the
    dentry, which might sometimes matter

    * tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux:
    9p: Remove unneeded cast from memory allocation
    9p: remove unused code in 9p
    net/9p: Fix sparse endian warning in trans_fd.c
    9p: Fix memory leak in v9fs_mount
    9p: retrieve fid from file when file instance exist.

    Linus Torvalds
     

02 Aug, 2020

1 commit


19 Jul, 2020

3 commits

  • p9_read_work and p9_fd_cancelled may be called concurrently.
    In some cases, req->req_list may be deleted by both p9_read_work
    and p9_fd_cancelled.

    We can fix it by ignoring replies associated with a cancelled
    request and ignoring cancelled request if message has been received
    before lock.

    Link: http://lkml.kernel.org/r/20200612090833.36149-1-wanghai38@huawei.com
    Fixes: 60ff779c4abb ("9p: client: remove unused code and any reference to "cancelled" function")
    Cc: # v3.12+
    Reported-by: syzbot+77a25acfa0382e06ab23@syzkaller.appspotmail.com
    Signed-off-by: Wang Hai
    Signed-off-by: Dominique Martinet

    Wang Hai
     
  • Address sparse endian warning:
    net/9p/trans_fd.c:932:28: warning: incorrect type in assignment (different base types)
    net/9p/trans_fd.c:932:28: expected restricted __be32 [addressable] [assigned] [usertype] s_addr
    net/9p/trans_fd.c:932:28: got unsigned long

    Link: http://lkml.kernel.org/r/20200618183417.5423-1-alexander.kapshuk@gmail.com
    Signed-off-by: Alexander Kapshuk
    Signed-off-by: Dominique Martinet

    Alexander Kapshuk
     
  • p9_fd_open just fgets file descriptors passed in from userspace, but
    doesn't verify that they are valid for read or writing. This gets
    cought down in the VFS when actually attempting a read or write, but
    a new warning added in linux-next upsets syzcaller.

    Fix this by just verifying the fds early on.

    Link: http://lkml.kernel.org/r/20200710085722.435850-1-hch@lst.de
    Reported-by: syzbot+e6f77e16ff68b2434a2c@syzkaller.appspotmail.com
    Signed-off-by: Christoph Hellwig
    [Dominique: amend goto as per Doug Nazar's review]
    Signed-off-by: Dominique Martinet

    Christoph Hellwig
     

14 Jul, 2020

1 commit

  • Simple fixes which require no deep knowledge of the code.

    Cc: Eric Van Hensbergen
    Cc: Latchesar Ionkov
    Cc: Dominique Martinet
    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     

21 Jun, 2020

1 commit

  • The user tool modinfo is used to get information on kernel modules, including a
    description where it is available.

    This patch adds a brief MODULE_DESCRIPTION to the following modules:

    9p
    drop_monitor
    esp4_offload
    esp6_offload
    fou
    fou6
    ila
    sch_fq
    sch_fq_codel
    sch_hhf

    Signed-off-by: Rob Gill
    Signed-off-by: David S. Miller

    Rob Gill
     

02 Jun, 2020

1 commit

  • Increase XEN_9PFS_RING_ORDER to 9 for performance reason. Order 9 is the
    max allowed by the protocol.

    We can't assume that all backends will support order 9. The xenstore
    property max-ring-page-order specifies the max order supported by the
    backend. We'll use max-ring-page-order for the size of the ring.

    This means that the size of the ring is not static
    (XEN_FLEX_RING_SIZE(9)) anymore. Change XEN_9PFS_RING_SIZE to take an
    argument and base the calculation on the order chosen at setup time.

    Finally, modify p9_xen_trans.maxsize to be divided by 4 compared to the
    original value. We need to divide it by 2 because we have two rings
    coming off the same order allocation: the in and out rings. This was a
    mistake in the original code. Also divide it further by 2 because we
    don't want a single request/reply to fill up the entire ring. There can
    be multiple requests/replies outstanding at any given time and if we use
    the full ring with one, we risk forcing the backend to wait for the
    client to read back more replies before continuing, which is not
    performant.

    Link: http://lkml.kernel.org/r/20200521193242.15953-1-sstabellini@kernel.org
    Signed-off-by: Stefano Stabellini
    Signed-off-by: Dominique Martinet

    Stefano Stabellini
     

27 Mar, 2020

1 commit

  • A user doesn't necessarily want to wait for all the requested data to
    be available, since the waiting time for each request is unbounded.

    The new method permits sending one read request at a time and getting
    the response ASAP, allowing to use 9pnet with synthetic file systems
    representing arbitrary data streams.

    Link: http://lkml.kernel.org/r/20200205204053.12751-1-l29ah@cock.li
    Signed-off-by: Sergey Alirzaev
    Signed-off-by: Dominique Martinet

    Sergey Alirzaev
     

28 Sep, 2019

1 commit

  • Pull 9p updates from Dominique Martinet:
    "Some of the usual small fixes and cleanup.

    Small fixes all around:
    - avoid overlayfs copy-up for PRIVATE mmaps
    - KUMSAN uninitialized warning for transport error
    - one syzbot memory leak fix in 9p cache
    - internal API cleanup for v9fs_fill_super"

    * tag '9p-for-5.4' of git://github.com/martinetd/linux:
    9p/vfs_super.c: Remove unused parameter data in v9fs_fill_super
    9p/cache.c: Fix memory leak in v9fs_cache_session_get_cookie
    9p: Transport error uninitialized
    9p: avoid attaching writeback_fid on mmap with type PRIVATE

    Linus Torvalds
     

03 Sep, 2019

1 commit

  • The p9_tag_alloc() does not initialize the transport error t_err field.
    The struct p9_req_t *req is allocated and stored in a struct p9_client
    variable. The field t_err is never initialized before p9_conn_cancel()
    checks its value.

    KUMSAN(KernelUninitializedMemorySantizer, a new error detection tool)
    reports this bug.

    ==================================================================
    BUG: KUMSAN: use of uninitialized memory in p9_conn_cancel+0x2d9/0x3b0
    Read of size 4 at addr ffff88805f9b600c by task kworker/1:2/1216

    CPU: 1 PID: 1216 Comm: kworker/1:2 Not tainted 5.2.0-rc4+ #28
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
    Workqueue: events p9_write_work
    Call Trace:
    dump_stack+0x75/0xae
    __kumsan_report+0x17c/0x3e6
    kumsan_report+0xe/0x20
    p9_conn_cancel+0x2d9/0x3b0
    p9_write_work+0x183/0x4a0
    process_one_work+0x4d1/0x8c0
    worker_thread+0x6e/0x780
    kthread+0x1ca/0x1f0
    ret_from_fork+0x35/0x40

    Allocated by task 1979:
    save_stack+0x19/0x80
    __kumsan_kmalloc.constprop.3+0xbc/0x120
    kmem_cache_alloc+0xa7/0x170
    p9_client_prepare_req.part.9+0x3b/0x380
    p9_client_rpc+0x15e/0x880
    p9_client_create+0x3d0/0xac0
    v9fs_session_init+0x192/0xc80
    v9fs_mount+0x67/0x470
    legacy_get_tree+0x70/0xd0
    vfs_get_tree+0x4a/0x1c0
    do_mount+0xba9/0xf90
    ksys_mount+0xa8/0x120
    __x64_sys_mount+0x62/0x70
    do_syscall_64+0x6d/0x1e0
    entry_SYSCALL_64_after_hwframe+0x44/0xa9

    Freed by task 0:
    (stack is not available)

    The buggy address belongs to the object at ffff88805f9b6008
    which belongs to the cache p9_req_t of size 144
    The buggy address is located 4 bytes inside of
    144-byte region [ffff88805f9b6008, ffff88805f9b6098)
    The buggy address belongs to the page:
    page:ffffea00017e6d80 refcount:1 mapcount:0 mapping:ffff888068b63740 index:0xffff88805f9b7d90 compound_mapcount: 0
    flags: 0x100000000010200(slab|head)
    raw: 0100000000010200 ffff888068b66450 ffff888068b66450 ffff888068b63740
    raw: ffff88805f9b7d90 0000000000100001 00000001ffffffff 0000000000000000
    page dumped because: kumsan: bad access detected
    ==================================================================

    Link: http://lkml.kernel.org/r/20190613070854.10434-1-shuaibinglu@126.com
    Signed-off-by: Lu Shuaibing
    [dominique.martinet@cea.fr: grouped the added init with the others]
    Signed-off-by: Dominique Martinet

    Lu Shuaibing
     

05 Aug, 2019

1 commit

  • Send and Receive completion is handled on a single CPU selected at
    the time each Completion Queue is allocated. Typically this is when
    an initiator instantiates an RDMA transport, or when a target
    accepts an RDMA connection.

    Some ULPs cannot open a connection per CPU to spread completion
    workload across available CPUs and MSI vectors. For such ULPs,
    provide an API that allows the RDMA core to select a completion
    vector based on the device's complement of available comp_vecs.

    ULPs that invoke ib_alloc_cq() with only comp_vector 0 are converted
    to use the new API so that their completion workloads interfere less
    with each other.

    Suggested-by: Håkon Bugge
    Signed-off-by: Chuck Lever
    Reviewed-by: Leon Romanovsky
    Cc:
    Cc:
    Link: https://lore.kernel.org/r/20190729171923.13428.52555.stgit@manet.1015granger.net
    Signed-off-by: Doug Ledford

    Chuck Lever
     

13 Jul, 2019

1 commit

  • Pull 9p updates from Dominique Martinet:
    "Two small fixes to properly cleanup the 9p transports list if
    virtio/xen module initialization fail.

    9p might otherwise try to access memory from a module that failed to
    register got freed"

    * tag '9p-for-5.3' of git://github.com/martinetd/linux:
    9p/xen: Add cleanup path in p9_trans_xen_init
    9p/virtio: Add cleanup path in p9_virtio_init

    Linus Torvalds
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to free software
    foundation 51 franklin street fifth floor boston ma 02111 1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 27 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Richard Fontana
    Reviewed-by: Alexios Zavras
    Reviewed-by: Steve Winslow
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528170026.981318839@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner