Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1686924 > unrolled thread
| Started by | Anna Schumaker <schumaker.anna@gmail.com> |
|---|---|
| First post | 2017-07-13 23:20 +0200 |
| Last post | 2017-07-17 21:10 +0200 |
| Articles | 20 — 9 participants |
Back to article view | Back to linux.kernel
[GIT PULL] Please pull NFS client changes for Linux 4.13 Anna Schumaker <schumaker.anna@gmail.com> - 2017-07-13 23:20 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-13 23:50 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Christoph Hellwig <hch@infradead.org> - 2017-07-14 09:10 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Anna Schumaker <schumaker.anna@gmail.com> - 2017-07-14 13:40 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Dave Jones <davej@codemonkey.org.uk> - 2017-07-14 16:30 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 "J. Bruce Fields" <bfields@fieldses.org> - 2017-07-14 18:40 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-14 21:10 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Dave Jones <davej@codemonkey.org.uk> - 2017-07-14 21:50 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-14 22:00 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Andrey Rybainin <ryabinin.a.a@gmail.com> - 2017-07-14 22:30 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Daniel Micay <danielmicay@gmail.com> - 2017-07-14 22:40 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Daniel Micay <danielmicay@gmail.com> - 2017-07-14 23:00 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-14 23:00 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Daniel Micay <danielmicay@gmail.com> - 2017-07-14 23:10 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Daniel Micay <danielmicay@gmail.com> - 2017-07-14 23:10 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Daniel Micay <danielmicay@gmail.com> - 2017-07-15 02:00 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Dave Jones <davej@codemonkey.org.uk> - 2017-07-16 23:20 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Trond Myklebust <trondmy@primarydata.com> - 2017-07-17 01:00 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 "davej@codemonkey.org.uk" <davej@codemonkey.org.uk> - 2017-07-17 05:10 +0200
Re: [GIT PULL] Please pull NFS client changes for Linux 4.13 Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-17 21:10 +0200
| From | Anna Schumaker <schumaker.anna@gmail.com> |
|---|---|
| Date | 2017-07-13 23:20 +0200 |
| Subject | [GIT PULL] Please pull NFS client changes for Linux 4.13 |
| Message-ID | <u2TGF-2pl-13@gated-at.bofh.it> |
Hi Linus,
The following changes since commit 32c1431eea4881a6b17bd7c639315010aeefa452:
Linux 4.12-rc5 (2017-06-11 16:48:20 -0700)
are available in the git repository at:
git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1
for you to fetch changes up to b4f937cffa66b3d56eb8f586e620d0b223a281a3:
NFS: Don't run wake_up_bit() when nobody is waiting... (2017-07-13 16:57:18 -0400)
Stable bugfixes:
- Fix -EACCESS on commit to DS handling
- Fix initialization of nfs_page_array->npages
- Only invalidate dentries that are actually invalid
Features:
- Enable NFSoRDMA transparent state migration
- Add support for lookup-by-filehandle
- Add support for nfs re-exporting
Other bugfixes and cleanups:
- Christoph cleaned up the way we declare NFS operations
- Clean up various internal structures
- Various cleanups to commits
- Various improvements to error handling
- Set the dt_type of . and .. entries in NFS v4
- Make slot allocation more reliable
- Fix fscache stat printing
- Fix uninitialized variable warnings
- Fix potential list overrun in nfs_atomic_open()
- Fix a race in NFSoRDMA RPC reply handler
- Fix return size for nfs42_proc_copy()
- Fix against MAC forgery timing attacks
As Bruce mentioned in his pull request, we didn't do a good job coordinating
with Christoph's patches from the beginning. I ended up rebasing my tree on
top of Christoph's nfs-ops branch to prevent duplicate commits. Apologies if
that was the wrong choice!
Cheers,
Anna
----------------------------------------------------------------
Anna Schumaker (1):
NFS: Set FATTR4_WORD0_TYPE for . and .. entries
Benjamin Coddington (3):
NFS: convert flags to bool
NFS: nfs_rename() - revalidate directories on -ERESTARTSYS
NFS: Fix initialization of nfs_page_array->npages
Christoph Hellwig (33):
sunrpc: properly type argument to kxdreproc_t
sunrpc: fix encoder callback prototypes
lockd: fix encoder callback prototypes
nfs: fix encoder callback prototypes
nfsd: fix encoder callback prototypes
sunrpc/auth_gss: nfsd: fix encoder callback prototypes
sunrpc: properly type argument to kxdrdproc_t
sunrpc: fix decoder callback prototypes
sunrpc/auth_gss: fix decoder callback prototypes
nfsd: fix decoder callback prototypes
lockd: fix decoder callback prototypes
nfs: fix decoder callback prototypes
nfs: don't cast callback decode/proc/encode routines
lockd: fix some weird indentation
sunrpc: move p_count out of struct rpc_procinfo
nfs: use ARRAY_SIZE() in the nfsacl_version3 declaration
sunrpc: mark all struct rpc_procinfo instances as const
nfsd4: const-ify nfs_cb_version4
nfsd: use named initializers in PROC()
nfsd: remove the unused PROC() macro in nfs3proc.c
sunrpc: properly type pc_func callbacks
sunrpc: properly type pc_release callbacks
sunrpc: properly type pc_decode callbacks
sunrpc: properly type pc_encode callbacks
sunrpc: remove kxdrproc_t
nfsd4: properly type op_set_currentstateid callbacks
nfsd4: properly type op_get_currentstateid callbacks
nfsd4: remove nfsd4op_rsize
nfsd4: properly type op_func callbacks
sunrpc: move pc_count out of struct svc_procinfo
sunrpc: mark all struct svc_procinfo instances as const
sunrpc: mark all struct svc_version instances as const
nfsd4: const-ify nfsd4_ops
Chuck Lever (13):
xprtrdma: On invalidation failure, remove MWs from rl_registered
xprtrdma: Pre-mark remotely invalidated MRs
xprtrdma: Pass only the list of registered MRs to ro_unmap_sync
xprtrdma: Rename rpcrdma_req::rl_free
xprtrdma: Fix client lock-up after application signal fires
xprtrdma: Fix FRWR invalidation error recovery
xprtrdma: Don't defer MR recovery if ro_map fails
NFSv4.1: Handle EXCHGID4_FLAG_CONFIRMED_R during NFSv4.1 migration
NFSv4.1: Use seqid returned by EXCHANGE_ID after state migration
xprtrdma: Demote "connect" log messages
xprtrdma: FMR does not need list_del_init()
xprtrdma: Replace PAGE_MASK with offset_in_page()
xprtrdma: Fix documenting comments in frwr_ops.c
Dan Carpenter (1):
NFS: silence a uninitialized variable warning
Jason A. Donenfeld (1):
sunrpc: use constant time memory comparison for mac
Jeff Layton (1):
nfs4: add NFSv4 LOOKUPP handlers
NeilBrown (3):
NFS: only invalidate dentrys that are clearly invalid.
NFS: guard against confused server in nfs_atomic_open()
NFS: check for nfs_refresh_inode() errors in nfs_fhget()
Olga Kornievskaia (3):
PNFS fix EACCESS on commit to DS handling
PNFS for stateid errors retry against MDS first
NFSv4.2 fix size storage for nfs42_proc_copy
Peng Tao (3):
nfs: replace d_add with d_splice_alias in atomic_open
nfs: add a nfs_ilookup helper
nfs: add export operations
Trond Myklebust (5):
SUNRPC: Make slot allocation more reliable
NFS: Remove unused fields in the page I/O structures
NFS: Ensure we commit after writeback is complete
NFS: Fix commit policy for non-blocking calls to nfs_write_inode()
NFS: Don't run wake_up_bit() when nobody is waiting...
Tuo Chen Peng (1):
nfs: Fix fscache stat printing in nfs_show_stats()
fs/lockd/clnt4xdr.c | 34 ++-
fs/lockd/clntxdr.c | 58 +++--
fs/lockd/mon.c | 38 +--
fs/lockd/svc.c | 38 +--
fs/lockd/svc4proc.c | 124 ++++++----
fs/lockd/svcproc.c | 124 ++++++----
fs/lockd/xdr.c | 43 ++--
fs/lockd/xdr4.c | 43 ++--
fs/nfs/Makefile | 2 +-
fs/nfs/callback.c | 2 +-
fs/nfs/callback.h | 27 +--
fs/nfs/callback_proc.c | 33 ++-
fs/nfs/callback_xdr.c | 113 +++++----
fs/nfs/dir.c | 42 ++--
fs/nfs/export.c | 177 ++++++++++++++
fs/nfs/filelayout/filelayout.c | 31 +--
fs/nfs/flexfilelayout/flexfilelayout.c | 33 ---
fs/nfs/inode.c | 36 ++-
fs/nfs/internal.h | 18 +-
fs/nfs/mount_clnt.c | 29 ++-
fs/nfs/nfs2xdr.c | 72 ++++--
fs/nfs/nfs3proc.c | 2 +-
fs/nfs/nfs3xdr.c | 153 ++++++++----
fs/nfs/nfs42proc.c | 2 +-
fs/nfs/nfs42xdr.c | 52 +++--
fs/nfs/nfs4_fs.h | 6 +-
fs/nfs/nfs4client.c | 5 +
fs/nfs/nfs4idmap.c | 3 +-
fs/nfs/nfs4proc.c | 109 ++++++---
fs/nfs/nfs4state.c | 16 +-
fs/nfs/nfs4trace.h | 29 +++
fs/nfs/nfs4xdr.c | 408 ++++++++++++++++++++++----------
fs/nfs/pagelist.c | 23 +-
fs/nfs/proc.c | 2 +-
fs/nfs/super.c | 4 +-
fs/nfs/unlink.c | 13 ++
fs/nfs/write.c | 59 ++++-
fs/nfsd/current_stateid.h | 36 ++-
fs/nfsd/nfs2acl.c | 116 +++++-----
fs/nfsd/nfs3acl.c | 75 +++---
fs/nfsd/nfs3proc.c | 301 ++++++++++++------------
fs/nfsd/nfs3xdr.c | 164 +++++++------
fs/nfsd/nfs4callback.c | 32 ++-
fs/nfsd/nfs4proc.c | 412 +++++++++++++++++----------------
fs/nfsd/nfs4state.c | 142 +++++++-----
fs/nfsd/nfs4xdr.c | 13 +-
fs/nfsd/nfsd.h | 6 +-
fs/nfsd/nfsproc.c | 206 +++++++++--------
fs/nfsd/nfssvc.c | 24 +-
fs/nfsd/nfsxdr.c | 92 +++++---
fs/nfsd/xdr.h | 50 ++--
fs/nfsd/xdr3.h | 100 +++-----
fs/nfsd/xdr4.h | 78 +++----
include/linux/lockd/lockd.h | 4 +-
include/linux/lockd/xdr.h | 26 +--
include/linux/lockd/xdr4.h | 26 +--
include/linux/nfs4.h | 1 +
include/linux/nfs_fs.h | 1 +
include/linux/nfs_fs_sb.h | 2 +
include/linux/nfs_page.h | 4 +-
include/linux/nfs_xdr.h | 31 ++-
include/linux/sunrpc/clnt.h | 6 +-
include/linux/sunrpc/sched.h | 2 +-
include/linux/sunrpc/svc.h | 21 +-
include/linux/sunrpc/xdr.h | 15 +-
net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 +-
net/sunrpc/auth_gss/gss_rpc_upcall.c | 9 +-
net/sunrpc/auth_gss/gss_rpc_xdr.c | 14 +-
net/sunrpc/auth_gss/gss_rpc_xdr.h | 4 +-
net/sunrpc/clnt.c | 16 +-
net/sunrpc/rpcb_clnt.c | 82 ++++---
net/sunrpc/stats.c | 16 +-
net/sunrpc/svc.c | 33 +--
net/sunrpc/xprt.c | 8 +-
net/sunrpc/xprtrdma/fmr_ops.c | 47 ++--
net/sunrpc/xprtrdma/frwr_ops.c | 69 +++---
net/sunrpc/xprtrdma/rpc_rdma.c | 125 ++++++----
net/sunrpc/xprtrdma/transport.c | 3 +-
net/sunrpc/xprtrdma/verbs.c | 55 ++---
net/sunrpc/xprtrdma/xprt_rdma.h | 40 +++-
80 files changed, 2733 insertions(+), 1780 deletions(-)
create mode 100644 fs/nfs/export.c
[toc] | [next] | [standalone]
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Date | 2017-07-13 23:50 +0200 |
| Message-ID | <u2U9H-2z1-5@gated-at.bofh.it> |
| In reply to | #1686924 |
On Thu, Jul 13, 2017 at 2:16 PM, Anna Schumaker
<schumaker.anna@gmail.com> wrote:
>
> git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1
Btw, your key seems to have expired, and doing a refresh on it doesn't fix it.
I'm sure you've refreshed your key, but apparently that refresh hasn't
been percolated to the public keyservers?
Linus
[toc] | [prev] | [next] | [standalone]
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Date | 2017-07-14 09:10 +0200 |
| Message-ID | <u32TE-8rx-1@gated-at.bofh.it> |
| In reply to | #1686939 |
On Thu, Jul 13, 2017 at 02:43:14PM -0700, Linus Torvalds wrote: > On Thu, Jul 13, 2017 at 2:16 PM, Anna Schumaker > <schumaker.anna@gmail.com> wrote: > > > > git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1 > > Btw, your key seems to have expired, and doing a refresh on it doesn't fix it. > > I'm sure you've refreshed your key, but apparently that refresh hasn't > been percolated to the public keyservers? As someone who has run into an issue in that area recently: I manually had to refresh and re-upload my signing subkey and not just the primary key, which wa rather confusing and took a long time to sort out.
[toc] | [prev] | [next] | [standalone]
| From | Anna Schumaker <schumaker.anna@gmail.com> |
|---|---|
| Date | 2017-07-14 13:40 +0200 |
| Message-ID | <u376W-2Kc-29@gated-at.bofh.it> |
| In reply to | #1687123 |
On 07/14/2017 03:09 AM, Christoph Hellwig wrote: > On Thu, Jul 13, 2017 at 02:43:14PM -0700, Linus Torvalds wrote: >> On Thu, Jul 13, 2017 at 2:16 PM, Anna Schumaker >> <schumaker.anna@gmail.com> wrote: >>> >>> git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1 >> >> Btw, your key seems to have expired, and doing a refresh on it doesn't fix it. >> >> I'm sure you've refreshed your key, but apparently that refresh hasn't >> been percolated to the public keyservers? I assumed I had refreshed it once git let me sign things again, but maybe I missed a step. > > As someone who has run into an issue in that area recently: I manually > had to refresh and re-upload my signing subkey and not just the primary > key, which wa rather confusing and took a long time to sort out. > I'll start here. Thanks for the tip! Anna
[toc] | [prev] | [next] | [standalone]
| From | Dave Jones <davej@codemonkey.org.uk> |
|---|---|
| Date | 2017-07-14 16:30 +0200 |
| Message-ID | <u39Lt-4DQ-9@gated-at.bofh.it> |
| In reply to | #1686924 |
On Thu, Jul 13, 2017 at 05:16:24PM -0400, Anna Schumaker wrote:
> Hi Linus,
>
> The following changes since commit 32c1431eea4881a6b17bd7c639315010aeefa452:
>
> Linux 4.12-rc5 (2017-06-11 16:48:20 -0700)
>
> are available in the git repository at:
>
> git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1
>
> for you to fetch changes up to b4f937cffa66b3d56eb8f586e620d0b223a281a3:
>
> NFS: Don't run wake_up_bit() when nobody is waiting... (2017-07-13 16:57:18 -0400)
Since this landed, I'm seeing this during boot..
==================================================================
BUG: KASAN: global-out-of-bounds in strscpy+0x4a/0x230
Read of size 8 at addr ffffffffb4eeaf20 by task nfsd/688
CPU: 0 PID: 688 Comm: nfsd Not tainted 4.12.0-firewall+ #14
Call Trace:
dump_stack+0x68/0x94
print_address_description+0x2c/0x270
? strscpy+0x4a/0x230
kasan_report+0x239/0x350
__asan_load8+0x55/0x90
strscpy+0x4a/0x230
__ip_map_lookup+0x85/0x150
? ip_map_init+0x50/0x50
? lock_acquire+0x270/0x270
svcauth_unix_set_client+0x9f3/0xdc0
? svcauth_unix_set_client+0x5/0xdc0
? unix_gid_parse+0x340/0x340
? kasan_kmalloc+0xbb/0xf0
? groups_alloc+0x29/0x80
? __kmalloc+0x13b/0x360
? groups_alloc+0x29/0x80
? groups_alloc+0x48/0x80
? svcauth_unix_accept+0x3a5/0x3c0
svc_set_client+0x50/0x60
svc_process+0x901/0x10b0
? svc_register+0x430/0x430
? __might_sleep+0x78/0xf0
? preempt_count_sub+0xaf/0x120
? __validate_process_creds+0x9e/0x160
nfsd+0x250/0x380
? nfsd+0x5/0x380
kthread+0x1ab/0x200
? nfsd_destroy+0x1f0/0x1f0
? __kthread_create_on_node+0x340/0x340
ret_from_fork+0x27/0x40
The buggy address belongs to the variable:
str__nfsd__trace_system_name+0x3a0/0x3e0
Memory state around the buggy address:
ffffffffb4eeae00: 00 00 00 01 fa fa fa fa 00 00 00 00 00 04 fa fa
ffffffffb4eeae80: fa fa fa fa 04 fa fa fa fa fa fa fa 04 fa fa fa
>ffffffffb4eeaf00: fa fa fa fa 05 fa fa fa fa fa fa fa 00 00 00 00
^
ffffffffb4eeaf80: 00 fa fa fa fa fa fa fa 00 00 05 fa fa fa fa fa
ffffffffb4eeb000: 00 03 fa fa fa fa fa fa 00 07 fa fa fa fa fa fa
==================================================================
[toc] | [prev] | [next] | [standalone]
| From | "J. Bruce Fields" <bfields@fieldses.org> |
|---|---|
| Date | 2017-07-14 18:40 +0200 |
| Message-ID | <u3bNf-600-9@gated-at.bofh.it> |
| In reply to | #1687474 |
On Fri, Jul 14, 2017 at 10:25:43AM -0400, Dave Jones wrote: > On Thu, Jul 13, 2017 at 05:16:24PM -0400, Anna Schumaker wrote: > > Hi Linus, > > > > The following changes since commit 32c1431eea4881a6b17bd7c639315010aeefa452: > > > > Linux 4.12-rc5 (2017-06-11 16:48:20 -0700) > > > > are available in the git repository at: > > > > git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1 > > > > for you to fetch changes up to b4f937cffa66b3d56eb8f586e620d0b223a281a3: > > > > NFS: Don't run wake_up_bit() when nobody is waiting... (2017-07-13 16:57:18 -0400) > > Since this landed, I'm seeing this during boot.. __ip_map_lookup does have a strcpy, and it looks like that can be implemented in terms of strscpy. Based on that backtrace, it should just be copying from nfsd_program->pg_class, which is initialized to "nfsd" and never changed. I spent a few minutes trying to figure out the tracing macros that define str__nfsd__trace_system_name+0x3a0/0x3e0 and gave up. So I have no idea what's going on.... --b. > > ================================================================== > BUG: KASAN: global-out-of-bounds in strscpy+0x4a/0x230 > Read of size 8 at addr ffffffffb4eeaf20 by task nfsd/688 > > CPU: 0 PID: 688 Comm: nfsd Not tainted 4.12.0-firewall+ #14 > Call Trace: > dump_stack+0x68/0x94 > print_address_description+0x2c/0x270 > ? strscpy+0x4a/0x230 > kasan_report+0x239/0x350 > __asan_load8+0x55/0x90 > strscpy+0x4a/0x230 > __ip_map_lookup+0x85/0x150 > ? ip_map_init+0x50/0x50 > ? lock_acquire+0x270/0x270 > svcauth_unix_set_client+0x9f3/0xdc0 > ? svcauth_unix_set_client+0x5/0xdc0 > ? unix_gid_parse+0x340/0x340 > ? kasan_kmalloc+0xbb/0xf0 > ? groups_alloc+0x29/0x80 > ? __kmalloc+0x13b/0x360 > ? groups_alloc+0x29/0x80 > ? groups_alloc+0x48/0x80 > ? svcauth_unix_accept+0x3a5/0x3c0 > svc_set_client+0x50/0x60 > svc_process+0x901/0x10b0 > ? svc_register+0x430/0x430 > ? __might_sleep+0x78/0xf0 > ? preempt_count_sub+0xaf/0x120 > ? __validate_process_creds+0x9e/0x160 > nfsd+0x250/0x380 > ? nfsd+0x5/0x380 > kthread+0x1ab/0x200 > ? nfsd_destroy+0x1f0/0x1f0 > ? __kthread_create_on_node+0x340/0x340 > ret_from_fork+0x27/0x40 > > The buggy address belongs to the variable: > str__nfsd__trace_system_name+0x3a0/0x3e0 > > Memory state around the buggy address: > ffffffffb4eeae00: 00 00 00 01 fa fa fa fa 00 00 00 00 00 04 fa fa > ffffffffb4eeae80: fa fa fa fa 04 fa fa fa fa fa fa fa 04 fa fa fa > >ffffffffb4eeaf00: fa fa fa fa 05 fa fa fa fa fa fa fa 00 00 00 00 > ^ > ffffffffb4eeaf80: 00 fa fa fa fa fa fa fa 00 00 05 fa fa fa fa fa > ffffffffb4eeb000: 00 03 fa fa fa fa fa fa 00 07 fa fa fa fa fa fa > ==================================================================
[toc] | [prev] | [next] | [standalone]
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Date | 2017-07-14 21:10 +0200 |
| Message-ID | <u3e8p-7II-5@gated-at.bofh.it> |
| In reply to | #1687474 |
On Fri, Jul 14, 2017 at 7:25 AM, Dave Jones <davej@codemonkey.org.uk> wrote:
> On Thu, Jul 13, 2017 at 05:16:24PM -0400, Anna Schumaker wrote:
> >
> > git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1
>
> Since this landed, I'm seeing this during boot..
>
> ==================================================================
> BUG: KASAN: global-out-of-bounds in strscpy+0x4a/0x230
> Read of size 8 at addr ffffffffb4eeaf20 by task nfsd/688
Is KASAN aware that strscpy() does the word-at-a-time optimistic reads
of the sources?
The problem may be that the source is initialized from the global
string "nfsd", and KASAN may be unhappy abotu the fact that we read 8
bytes from a 5-byte string (four plus NUL) as we do the word-at-a-time
strscpy..
That said, we do check the size first (because we also *write* 8 bytes
at a time), so maybe KASAN shouldn't even need to care.
Hmm. it really looks to me like this is actually a compiler bug (I'm
using current gcc in F26, which is gcc-7.1.1 - I'm assuming DaveJ is
the same).
This is the source code in __ip_map_lookup:
struct ip_map ip;
.....
strcpy(ip.m_class, class);
and "m_class" is 8 bytes in size:
struct ip_map {
...
char m_class[8]; /* e.g. "nfsd" */
...
yet when I look at the generated code for __ip_map_lookup, I see
movl $32, %edx #,
movq %r13, %rsi # class,
leaq 48(%rax), %rdi #, tmp126
call strscpy #
what's the bug here? Look at that third argument - %rdx. It is
initialized to 32.
WTF?
The code to turn "strcpy()" into "strscpy()" should pick the *smaller*
of the two object sizes as the size argument. How the hell is that
size argument 32?
Am I missing something? DaveJ, do you see the same?
Linus
[toc] | [prev] | [next] | [standalone]
| From | Dave Jones <davej@codemonkey.org.uk> |
|---|---|
| Date | 2017-07-14 21:50 +0200 |
| Message-ID | <u3eL8-7Y5-27@gated-at.bofh.it> |
| In reply to | #1687610 |
On Fri, Jul 14, 2017 at 12:05:02PM -0700, Linus Torvalds wrote:
> On Fri, Jul 14, 2017 at 7:25 AM, Dave Jones <davej@codemonkey.org.uk> wrote:
> > On Thu, Jul 13, 2017 at 05:16:24PM -0400, Anna Schumaker wrote:
> > >
> > > git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1
> >
> > Since this landed, I'm seeing this during boot..
> >
> > ==================================================================
> > BUG: KASAN: global-out-of-bounds in strscpy+0x4a/0x230
> > Read of size 8 at addr ffffffffb4eeaf20 by task nfsd/688
>
> Is KASAN aware that strscpy() does the word-at-a-time optimistic reads
> of the sources?
>
> The problem may be that the source is initialized from the global
> string "nfsd", and KASAN may be unhappy abotu the fact that we read 8
> bytes from a 5-byte string (four plus NUL) as we do the word-at-a-time
> strscpy..
>
> That said, we do check the size first (because we also *write* 8 bytes
> at a time), so maybe KASAN shouldn't even need to care.
>
> Hmm. it really looks to me like this is actually a compiler bug (I'm
> using current gcc in F26, which is gcc-7.1.1 - I'm assuming DaveJ is
> the same).
Debian's 6.4.0
> This is the source code in __ip_map_lookup:
>
> struct ip_map ip;
> .....
> strcpy(ip.m_class, class);
>
> and "m_class" is 8 bytes in size:
>
> struct ip_map {
> ...
> char m_class[8]; /* e.g. "nfsd" */
> ...
>
> yet when I look at the generated code for __ip_map_lookup, I see
>
> movl $32, %edx #,
> movq %r13, %rsi # class,
> leaq 48(%rax), %rdi #, tmp126
> call strscpy #
>
> what's the bug here? Look at that third argument - %rdx. It is
> initialized to 32.
>
> WTF?
>
> The code to turn "strcpy()" into "strscpy()" should pick the *smaller*
> of the two object sizes as the size argument. How the hell is that
> size argument 32?
>
> Am I missing something? DaveJ, do you see the same?
My compiler seems to have replaced the call with an inlined copy afaics.
0000000000000be0 <__ip_map_lookup>:
{
be0: e8 00 00 00 00 callq be5 <__ip_map_lookup+0x5>
be5: 55 push %rbp
be6: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
bed: fc ff df
bf0: 48 89 e5 mov %rsp,%rbp
bf3: 41 57 push %r15
bf5: 41 56 push %r14
bf7: 4c 8d 32 lea (%rdx),%r14
if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0)
bfa: ba 20 00 00 00 mov $0x20,%edx
bff: 41 55 push %r13
c01: 4c 8d 2e lea (%rsi),%r13
c04: 41 54 push %r12
c06: 53 push %rbx
c07: 48 8d 1f lea (%rdi),%rbx
c0a: 48 8d a4 24 60 ff ff lea -0xa0(%rsp),%rsp
c11: ff
c12: 49 89 e4 mov %rsp,%r12
c15: 49 c1 ec 03 shr $0x3,%r12
c19: 48 c7 04 24 b3 8a b5 movq $0x41b58ab3,(%rsp)
c20: 41
c21: 48 c7 44 24 08 00 00 movq $0x0,0x8(%rsp)
c28: 00 00
c2a: 48 c7 44 24 10 00 00 movq $0x0,0x10(%rsp)
c31: 00 00
c33: 48 8d 7c 24 50 lea 0x50(%rsp),%rdi
c38: 4d 8d 24 04 lea (%r12,%rax,1),%r12
c3c: 41 c7 04 24 f1 f1 f1 movl $0xf1f1f1f1,(%r12)
c43: f1
c44: 41 c7 44 24 0c 00 00 movl $0xf4f40000,0xc(%r12)
c4b: f4 f4
c4d: 65 48 8b 04 25 28 00 mov %gs:0x28,%rax
c54: 00 00
c56: 48 89 84 24 98 00 00 mov %rax,0x98(%rsp)
c5d: 00
c5e: 31 c0 xor %eax,%eax
c60: e8 00 00 00 00 callq c65 <__ip_map_lookup+0x85>
c65: 48 85 c0 test %rax,%rax
c68: 0f 88 a0 00 00 00 js d0e <__ip_map_lookup+0x12e>
ip.m_addr = *addr;
c6e: be 10 00 00 00 mov $0x10,%esi
c73: 49 8d 3e lea (%r14),%rdi
c76: e8 00 00 00 00 callq c7b <__ip_map_lookup+0x9b>
c7b: 49 8b 56 08 mov 0x8(%r14),%rdx
But that mov $0x20,%edx looks like it might be the same value we're talking about.
Dave
[toc] | [prev] | [next] | [standalone]
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Date | 2017-07-14 22:00 +0200 |
| Message-ID | <u3eUN-82b-1@gated-at.bofh.it> |
| In reply to | #1687610 |
On Fri, Jul 14, 2017 at 12:43 PM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
>
>> yet when I look at the generated code for __ip_map_lookup, I see
>>
>> movl $32, %edx #,
>> movq %r13, %rsi # class,
>> leaq 48(%rax), %rdi #, tmp126
>> call strscpy #
>>
>> what's the bug here? Look at that third argume8nt - %rdx. It is
>> initialized to 32.
>
> It's not a compiler bug, it's a bug in our strcpy().
> Whoever wrote this strcpy() into strscpy() code apparently didn't read carefully
> enough gcc manual about __builtin_object_size().
>
> Summary from https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html :
>
> __builtin_object_size(ptr, type) returns a constant number of bytes from 'ptr' to the end of the object 'ptr'
> pointer points to. "type" is an integer constant from 0 to 3. If the least significant bit is clear, objects
> are whole variables, if it is set, a closest surrounding subobject is considered the object a pointer points to.
> The second bit determines if maximum or minimum of remaining bytes is computed.
>
> We have type = 0 in strcpy(), so the least significant bit is clear. So the 'ptr' is considered as a pointer to the whole
> variable i.e. pointer to struct ip_map ip;
> And the number of bytes from 'ip.m_class' to the end of the ip object is exactly 32.
>
> I suppose that changing the type to 1 should fix this bug.
Oh, that absolutely needs to be done.
Because that "strcpy() -> strscpy()" conversion really depends on that
size being the right size (well, in this case minimal safe size) for
the actual accesses, exactly because "strscpy()" is perfectly willing
to write *past* the end of the destination string within that given
size limit (ie it reads and writes in the same 8-byte chunks).
So if you have a small target string that is contained in a big
object, then the "hardened" strcpy() code can actually end up
overwriting things past the end of the strring, even if the string
itself were to have fit in the buffer.
I note that every single use in string.h is buggy, and it worries me
that __compiletime_object_size() does this too. The only user of that
seems to be check_copy_size(), and now I'm a bit worried what that bug
may have hidden.
I find "hardening" code that adds bugs to be particularly bad and
ugly, the same way that I absolutely *hate* debugging code that turns
out to make debugging impossible (we had that with the "better" stack
tracing code that caused kernel panics to kill the machine entirely
rather than show the backtrace, and I'm still bitter about it a decade
after the fact).
There is something actively *evil* about it. Daniel, Kees, please jump on this.
Andrey, thanks for noticing this thing,
Linus
[toc] | [prev] | [next] | [standalone]
| From | Andrey Rybainin <ryabinin.a.a@gmail.com> |
|---|---|
| Date | 2017-07-14 22:30 +0200 |
| Message-ID | <u3fnQ-8td-5@gated-at.bofh.it> |
| In reply to | #1687631 |
On 07/14/2017 10:58 PM, Linus Torvalds wrote: > On Fri, Jul 14, 2017 at 12:43 PM, Andrey Ryabinin > <aryabinin@virtuozzo.com> wrote: >> >>> yet when I look at the generated code for __ip_map_lookup, I see >>> >>> movl $32, %edx #, >>> movq %r13, %rsi # class, >>> leaq 48(%rax), %rdi #, tmp126 >>> call strscpy # >>> >>> what's the bug here? Look at that third argume8nt - %rdx. It is >>> initialized to 32. >> >> It's not a compiler bug, it's a bug in our strcpy(). >> Whoever wrote this strcpy() into strscpy() code apparently didn't read carefully >> enough gcc manual about __builtin_object_size(). >> >> Summary from https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html : >> >> __builtin_object_size(ptr, type) returns a constant number of bytes from 'ptr' to the end of the object 'ptr' >> pointer points to. "type" is an integer constant from 0 to 3. If the least significant bit is clear, objects >> are whole variables, if it is set, a closest surrounding subobject is considered the object a pointer points to. >> The second bit determines if maximum or minimum of remaining bytes is computed. >> >> We have type = 0 in strcpy(), so the least significant bit is clear. So the 'ptr' is considered as a pointer to the whole >> variable i.e. pointer to struct ip_map ip; >> And the number of bytes from 'ip.m_class' to the end of the ip object is exactly 32. >> >> I suppose that changing the type to 1 should fix this bug. > > Oh, that absolutely needs to be done. > > Because that "strcpy() -> strscpy()" conversion really depends on that > size being the right size (well, in this case minimal safe size) for > the actual accesses, exactly because "strscpy()" is perfectly willing > to write *past* the end of the destination string within that given > size limit (ie it reads and writes in the same 8-byte chunks). > > So if you have a small target string that is contained in a big > object, then the "hardened" strcpy() code can actually end up > overwriting things past the end of the strring, even if the string > itself were to have fit in the buffer. > > I note that every single use in string.h is buggy, and it worries me > that __compiletime_object_size() does this too. The only user of that > seems to be check_copy_size(), and now I'm a bit worried what that bug > may have hidden. > > I find "hardening" code that adds bugs to be particularly bad and > ugly, the same way that I absolutely *hate* debugging code that turns > out to make debugging impossible (we had that with the "better" stack > tracing code that caused kernel panics to kill the machine entirely > rather than show the backtrace, and I'm still bitter about it a decade > after the fact). > A have some more news to make you even more "happier" :) strcpy() choose to copy 32-bytes instead of smaller 5-bytes because it has one more bug :) GCC couldn't determine size of class (which is 5-byte string): strcpy(ip.m_class, class); So, p_size = 32 and q_size = -1, this "if (p_size == (size_t)-1 && q_size == (size_t)-1)" is false (because of bogus '&&', obviously we should have '||' here) and since (32 < (size_t)-1) if (strscpy(p, q, p_size < q_size ? p_size : q_size) < 0) we end up with 32-bytes strscpy(). Enjoy :) > There is something actively *evil* about it. Daniel, Kees, please jump on this. > > Andrey, thanks for noticing this thing, > > Linus >
[toc] | [prev] | [next] | [standalone]
| From | Daniel Micay <danielmicay@gmail.com> |
|---|---|
| Date | 2017-07-14 22:40 +0200 |
| Message-ID | <u3fxw-6x-9@gated-at.bofh.it> |
| In reply to | #1687631 |
On Fri, 2017-07-14 at 12:58 -0700, Linus Torvalds wrote: > On Fri, Jul 14, 2017 at 12:43 PM, Andrey Ryabinin > <aryabinin@virtuozzo.com> wrote: > > > > > yet when I look at the generated code for __ip_map_lookup, I see > > > > > > movl $32, %edx #, > > > movq %r13, %rsi # class, > > > leaq 48(%rax), %rdi #, tmp126 > > > call strscpy # > > > > > > what's the bug here? Look at that third argume8nt - %rdx. It is > > > initialized to 32. > > > > It's not a compiler bug, it's a bug in our strcpy(). > > Whoever wrote this strcpy() into strscpy() code apparently didn't > > read carefully > > enough gcc manual about __builtin_object_size(). > > > > Summary from https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking > > .html : > > > > __builtin_object_size(ptr, type) returns a constant number > > of bytes from 'ptr' to the end of the object 'ptr' > > pointer points to. "type" is an integer constant from 0 to > > 3. If the least significant bit is clear, objects > > are whole variables, if it is set, a closest surrounding > > subobject is considered the object a pointer points to. > > The second bit determines if maximum or minimum of remaining > > bytes is computed. > > > > We have type = 0 in strcpy(), so the least significant bit is clear. > > So the 'ptr' is considered as a pointer to the whole > > variable i.e. pointer to struct ip_map ip; > > And the number of bytes from 'ip.m_class' to the end of the ip > > object is exactly 32. > > > > I suppose that changing the type to 1 should fix this bug. > > Oh, that absolutely needs to be done. > > Because that "strcpy() -> strscpy()" conversion really depends on that > size being the right size (well, in this case minimal safe size) for > the actual accesses, exactly because "strscpy()" is perfectly willing > to write *past* the end of the destination string within that given > size limit (ie it reads and writes in the same 8-byte chunks). > > So if you have a small target string that is contained in a big > object, then the "hardened" strcpy() code can actually end up > overwriting things past the end of the strring, even if the string > itself were to have fit in the buffer. > > I note that every single use in string.h is buggy, and it worries me > that __compiletime_object_size() does this too. The only user of that > seems to be check_copy_size(), and now I'm a bit worried what that bug > may have hidden. > > I find "hardening" code that adds bugs to be particularly bad and > ugly, the same way that I absolutely *hate* debugging code that turns > out to make debugging impossible (we had that with the "better" stack > tracing code that caused kernel panics to kill the machine entirely > rather than show the backtrace, and I'm still bitter about it a decade > after the fact). > > There is something actively *evil* about it. Daniel, Kees, please jump > on this. > > Andrey, thanks for noticing this thing, > > Linus The issue is the usage of strscpy then, not the __builtin_object_size type parameter. The type is set 0 rather than 1 to be more lenient by not detecting intra-object overflow, which is going to come later. If strscpy treats the count parameter as a *guarantee* of the dest size rather than a limit, it's wrong to use it there, whether or not the type parameter for __builtin_object_size is 0 or 1 since it can still return a larger size. It's a limit with no guaranteed minimum. My initial patch used strlcpy there, because I wasn't aware of strscpy before it was suggested: http://www.openwall.com/lists/kernel-hardening/2017/05/04/11 I was wrong to move it to strscpy. It could be switched back to strlcpy again unless the kernel considers the count parameter to be a guarantee that could be leveraged in the future. Using the fortified strlen + memcpy would provide the improvement that strscpy was meant to provide there over strlcpy.
[toc] | [prev] | [next] | [standalone]
| From | Daniel Micay <danielmicay@gmail.com> |
|---|---|
| Date | 2017-07-14 23:00 +0200 |
| Message-ID | <u3fQR-eC-7@gated-at.bofh.it> |
| In reply to | #1687656 |
> My initial patch used strlcpy there, because I wasn't aware of strscpy > before it was suggested: > > http://www.openwall.com/lists/kernel-hardening/2017/05/04/11 > > I was wrong to move it to strscpy. It could be switched back to > strlcpy > again unless the kernel considers the count parameter to be a > guarantee > that could be leveraged in the future. Using the fortified strlen + > memcpy would provide the improvement that strscpy was meant to provide > there over strlcpy. Similarly, the FORTIFY_SOURCE strcat uses strlcat with the assumption that the count parameter is a limit, not a guarantee for a optimization. There's only a C implementation and it currently doesn't, but if it's meant to be a guarantee then the strcat needs to be changed too. I'll make a fix moving away both from the existing functions.
[toc] | [prev] | [next] | [standalone]
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Date | 2017-07-14 23:00 +0200 |
| Message-ID | <u3fQS-eC-17@gated-at.bofh.it> |
| In reply to | #1687656 |
On Fri, Jul 14, 2017 at 1:38 PM, Daniel Micay <danielmicay@gmail.com> wrote:
>
> If strscpy treats the count parameter as a *guarantee* of the dest size
> rather than a limit,
No, it's a *limit*.
And by a *limit*, I mean that we know that we can access both source
and destination within that limit.
> My initial patch used strlcpy there, because I wasn't aware of strscpy
> before it was suggested:
Since I'm looking at this, I note that the "strlcpy()" code is
complete garbage too, and has that same
p_size == (size_t)-1 && q_size == (size_t)-1
check which is wrong. Of course, in strlcpy, q_size is never actually
*used*, so the whole check seems bogus.
But no, strlcpy() is complete garbage, and should never be used. It is
truly a shit interface, and anybody who uses it is by definition
buggy.
Why? Because the return value of "strlcpy()" is defined to be ignoring
the limit, so you FUNDAMENTALLY must not use that thing on untrusted
source strings.
But since the whole *point* of people using it is for untrusted
sources, it by definition is garbage.
Ergo: don't use strlcpy(). It's unbelievable crap. It's wrong. There's
a reason we defined "strscpy()" as the way to do safe copies
(strncpy(), of course, is broken for both lack of NUL termination
_and_ for excessive NUL termination when a NUL did exist).
So quite frankly, this hardening code needs to be looked at again. And
no, if it uses "strlcpy()", then it's not hardering, it's just a pile
of crap.
Yes, I'm annoyed. I really get very very annoyed by "hardening" code
that does nothing of the kind.
Linus
[toc] | [prev] | [next] | [standalone]
| From | Daniel Micay <danielmicay@gmail.com> |
|---|---|
| Date | 2017-07-14 23:10 +0200 |
| Message-ID | <u3g0y-zd-9@gated-at.bofh.it> |
| In reply to | #1687668 |
On Fri, 2017-07-14 at 13:50 -0700, Linus Torvalds wrote: > On Fri, Jul 14, 2017 at 1:38 PM, Daniel Micay <danielmicay@gmail.com> > wrote: > > > > If strscpy treats the count parameter as a *guarantee* of the dest > > size > > rather than a limit, > > No, it's a *limit*. > > And by a *limit*, I mean that we know that we can access both source > and destination within that limit. FORTIFY_SOURCE needs to be able to pass a limit without implying that there's a minimum. That's the distinction I was trying to make. It's wrong to use anything where it's interpreted as a minimum here. Using __builtin_object_size(ptr, 0) vs. __builtin_object_size(ptr, 1) doesn't avoid the problem. __builtin_object_size(ptr, 1) returns a maximum among the possible buffer sizes just like 0. It's just stricter, i.e. catches intra-object overflow, which isn't desirable for the first take since it will cause compatibility issues. There's code using memcpy, copy_to_user, etc. to read / write multiple fields with a pointer to the first one passed as the source / destination. > > My initial patch used strlcpy there, because I wasn't aware of > > strscpy > > before it was suggested: > > Since I'm looking at this, I note that the "strlcpy()" code is > complete garbage too, and has that same > > p_size == (size_t)-1 && q_size == (size_t)-1 > > check which is wrong. Of course, in strlcpy, q_size is never actually > *used*, so the whole check seems bogus. That check is only an optimization. __builtin_object_size always returns a constant, and it's (size_t)-1 when no limit could be found. The reason q_size isn't used is because it doesn't yet prevent read overflow. The commit message mentions that among the current limitations along with __builtin_object_size(ptr, 1). > But no, strlcpy() is complete garbage, and should never be used. It is > truly a shit interface, and anybody who uses it is by definition > buggy. > > Why? Because the return value of "strlcpy()" is defined to be ignoring > the limit, so you FUNDAMENTALLY must not use that thing on untrusted > source strings. > > But since the whole *point* of people using it is for untrusted > sources, it by definition is garbage. > > Ergo: don't use strlcpy(). It's unbelievable crap. It's wrong. There's > a reason we defined "strscpy()" as the way to do safe copies > (strncpy(), of course, is broken for both lack of NUL termination > _and_ for excessive NUL termination when a NUL did exist). Sure, it doesn't prevent read overflow (but it's not worse than strcpy, which is the purpose) which is why I said this: "The fortified string functions should place a limit on reads from the source. For strcat/strcpy, these could just be a variant of strlcat / strlcpy using the size limit as a bound on both the source and destination, with the return value only reporting whether truncation occurred rather than providing the source length. It would be an easier API for developers to use too and not that it really matters but it would be more efficient for the case where truncation is intended." That's why strscpy was suggested and I switched to that + updated the commit message to only mention strcat, but it's wrong to use it here because __builtin_object_size(p, 0) / __builtin_object_size(p, 1) are only a guaranteed maximum length with no minimum guarantee.
[toc] | [prev] | [next] | [standalone]
| From | Daniel Micay <danielmicay@gmail.com> |
|---|---|
| Date | 2017-07-14 23:10 +0200 |
| Message-ID | <u3g0y-zd-21@gated-at.bofh.it> |
| In reply to | #1687670 |
> The reason q_size isn't used is because it doesn't yet prevent read > overflow. The commit message mentions that among the current > limitations > along with __builtin_object_size(ptr, 1). Er rather, in strlcat, the q_size is unused after the fast path is because strnlen obtains the constant again itself.
[toc] | [prev] | [next] | [standalone]
| From | Daniel Micay <danielmicay@gmail.com> |
|---|---|
| Date | 2017-07-15 02:00 +0200 |
| Message-ID | <u3iF4-28N-11@gated-at.bofh.it> |
| In reply to | #1687631 |
> I find "hardening" code that adds bugs to be particularly bad and > ugly, the same way that I absolutely *hate* debugging code that turns > out to make debugging impossible (we had that with the "better" stack > tracing code that caused kernel panics to kill the machine entirely > rather than show the backtrace, and I'm still bitter about it a decade > after the fact). Agree, it's very important for this code to be correct and the string functions have some subtleties so it needs scrutiny. I messed up strcpy between v1 and v2 trying to add a proper read overflow check. My fault for not looking more closely at strscpy before adopting it based on my misinterpretation of the API. This is primarily a bug finding feature right now and it has gotten a few fixed that actually matter (most were unimportant memcpy read past end of string constant but not all). I don't think it has another bug like this strscpy misuse itself, but there will need to be some more fixes for minor read overflows, etc. elsewhere in the tree before it'll actually make sense as a hardening feature because it can turn a benign read overflow into a DoS via BUG(). I think it will be fine for 4.13, but I definitely wouldn't propose 'default y' for a while, even if there was no performance cost (and there is). Fix for this issue is here in case anyone just looks only at this thread (realized I should have passed send-email a reply id): http://marc.info/?l=linux-fsdevel&m=150006772418003&w=2
[toc] | [prev] | [next] | [standalone]
| From | Dave Jones <davej@codemonkey.org.uk> |
|---|---|
| Date | 2017-07-16 23:20 +0200 |
| Message-ID | <u3Z7l-4i4-41@gated-at.bofh.it> |
| In reply to | #1687474 |
On Fri, Jul 14, 2017 at 10:25:43AM -0400, Dave Jones wrote:
> On Thu, Jul 13, 2017 at 05:16:24PM -0400, Anna Schumaker wrote:
> > Hi Linus,
> >
> > The following changes since commit 32c1431eea4881a6b17bd7c639315010aeefa452:
> >
> > Linux 4.12-rc5 (2017-06-11 16:48:20 -0700)
> >
> > are available in the git repository at:
> >
> > git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-for-4.13-1
> >
> > for you to fetch changes up to b4f937cffa66b3d56eb8f586e620d0b223a281a3:
> >
> > NFS: Don't run wake_up_bit() when nobody is waiting... (2017-07-13 16:57:18 -0400)
>
> Since this landed, I'm seeing this during boot..
>
> ==================================================================
> BUG: KASAN: global-out-of-bounds in strscpy+0x4a/0x230
> Read of size 8 at addr ffffffffb4eeaf20 by task nfsd/688
Now that this one got fixed, this one fell out instead..
Will dig deeper tomorrow.
==================================================================
BUG: KASAN: global-out-of-bounds in call_start+0x93/0x100
Read of size 8 at addr ffffffff8d582588 by task kworker/0:1/22
CPU: 0 PID: 22 Comm: kworker/0:1 Not tainted 4.13.0-rc1-firewall+ #1
Workqueue: rpciod rpc_async_schedule
Call Trace:
dump_stack+0x68/0x94
print_address_description+0x2c/0x270
? call_start+0x93/0x100
kasan_report+0x239/0x350
__asan_load8+0x55/0x90
call_start+0x93/0x100
? rpc_default_callback+0x10/0x10
? rpc_default_callback+0x10/0x10
__rpc_execute+0x170/0x740
? rpc_wake_up_queued_task+0x50/0x50
? __lock_is_held+0x9f/0x110
rpc_async_schedule+0x12/0x20
process_one_work+0x4ba/0xb10
? process_one_work+0x401/0xb10
? pwq_dec_nr_in_flight+0x120/0x120
worker_thread+0x91/0x670
? __sched_text_start+0x8/0x8
kthread+0x1ab/0x200
? process_one_work+0xb10/0xb10
? __kthread_create_on_node+0x340/0x340
ret_from_fork+0x27/0x40
The buggy address belongs to the variable:
nfs_cb_version+0x8/0x740
Memory state around the buggy address:
ffffffff8d582480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffffff8d582500: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa
>ffffffff8d582580: 00 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
^
ffffffff8d582600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffffff8d582680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
[toc] | [prev] | [next] | [standalone]
| From | Trond Myklebust <trondmy@primarydata.com> |
|---|---|
| Date | 2017-07-17 01:00 +0200 |
| Message-ID | <u40G6-58Y-13@gated-at.bofh.it> |
| In reply to | #1688539 |
Hi Dave,
On Sun, 2017-07-16 at 17:15 -0400, Dave Jones wrote:
> On Fri, Jul 14, 2017 at 10:25:43AM -0400, Dave Jones wrote:
> > On Thu, Jul 13, 2017 at 05:16:24PM -0400, Anna Schumaker wrote:
> > > Hi Linus,
> > >
> > > The following changes since commit
> 32c1431eea4881a6b17bd7c639315010aeefa452:
> > >
> > > Linux 4.12-rc5 (2017-06-11 16:48:20 -0700)
> > >
> > > are available in the git repository at:
> > >
> > > git://git.linux-nfs.org/projects/anna/linux-nfs.git tags/nfs-
> for-4.13-1
> > >
> > > for you to fetch changes up to
> b4f937cffa66b3d56eb8f586e620d0b223a281a3:
> > >
> > > NFS: Don't run wake_up_bit() when nobody is waiting... (2017-
> 07-13 16:57:18 -0400)
> >
> > Since this landed, I'm seeing this during boot..
> >
> > =================================================================
> =
> > BUG: KASAN: global-out-of-bounds in strscpy+0x4a/0x230
> > Read of size 8 at addr ffffffffb4eeaf20 by task nfsd/688
>
> Now that this one got fixed, this one fell out instead..
> Will dig deeper tomorrow.
>
> ==================================================================
> BUG: KASAN: global-out-of-bounds in call_start+0x93/0x100
> Read of size 8 at addr ffffffff8d582588 by task kworker/0:1/22
>
> CPU: 0 PID: 22 Comm: kworker/0:1 Not tainted 4.13.0-rc1-firewall+ #1
> Workqueue: rpciod rpc_async_schedule
> Call Trace:
> dump_stack+0x68/0x94
> print_address_description+0x2c/0x270
> ? call_start+0x93/0x100
> kasan_report+0x239/0x350
> __asan_load8+0x55/0x90
> call_start+0x93/0x100
> ? rpc_default_callback+0x10/0x10
> ? rpc_default_callback+0x10/0x10
> __rpc_execute+0x170/0x740
> ? rpc_wake_up_queued_task+0x50/0x50
> ? __lock_is_held+0x9f/0x110
> rpc_async_schedule+0x12/0x20
> process_one_work+0x4ba/0xb10
> ? process_one_work+0x401/0xb10
> ? pwq_dec_nr_in_flight+0x120/0x120
> worker_thread+0x91/0x670
> ? __sched_text_start+0x8/0x8
> kthread+0x1ab/0x200
> ? process_one_work+0xb10/0xb10
> ? __kthread_create_on_node+0x340/0x340
> ret_from_fork+0x27/0x40
>
> The buggy address belongs to the variable:
> nfs_cb_version+0x8/0x740
Does the following patch fix it?
Cheers
Trond
8<--------------------------------------
From b9230cdfbbee90178a1318d20cd3373ffb758788 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust@primarydata.com>
Date: Sun, 16 Jul 2017 18:52:18 -0400
Subject: [PATCH] nfsd: Fix a memory scribble in the callback channel
The offset of the entry in struct rpc_version has to match the version
number.
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Fixes: 1c5876ddbdb4 ("sunrpc: move p_count out of struct rpc_procinfo")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
fs/nfsd/nfs4callback.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index b45083c0f9ae..49b0a9e7ff18 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -720,8 +720,8 @@ static const struct rpc_version nfs_cb_version4 = {
.counts = nfs4_cb_counts,
};
-static const struct rpc_version *nfs_cb_version[] = {
- &nfs_cb_version4,
+static const struct rpc_version *nfs_cb_version[2] = {
+ [1] = &nfs_cb_version4,
};
static const struct rpc_program cb_program;
@@ -795,7 +795,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
.saddress = (struct sockaddr *) &conn->cb_saddr,
.timeout = &timeparms,
.program = &cb_program,
- .version = 0,
+ .version = 1,
.flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
};
struct rpc_clnt *client;
--
2.13.3
--
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com
[toc] | [prev] | [next] | [standalone]
| From | "davej@codemonkey.org.uk" <davej@codemonkey.org.uk> |
|---|---|
| Date | 2017-07-17 05:10 +0200 |
| Message-ID | <u44A4-7UE-21@gated-at.bofh.it> |
| In reply to | #1688548 |
On Sun, Jul 16, 2017 at 10:57:27PM +0000, Trond Myklebust wrote: > > BUG: KASAN: global-out-of-bounds in call_start+0x93/0x100 > > Read of size 8 at addr ffffffff8d582588 by task kworker/0:1/22 > > Does the following patch fix it? Yep, seems to do the trick! Dave
[toc] | [prev] | [next] | [standalone]
| From | Linus Torvalds <torvalds@linux-foundation.org> |
|---|---|
| Date | 2017-07-17 21:10 +0200 |
| Message-ID | <u4jz4-zE-11@gated-at.bofh.it> |
| In reply to | #1688618 |
On Sun, Jul 16, 2017 at 8:05 PM, davej@codemonkey.org.uk
<davej@codemonkey.org.uk> wrote:
> On Sun, Jul 16, 2017 at 10:57:27PM +0000, Trond Myklebust wrote:
>
> > > BUG: KASAN: global-out-of-bounds in call_start+0x93/0x100
> > > Read of size 8 at addr ffffffff8d582588 by task kworker/0:1/22
> >
> > Does the following patch fix it?
>
> Yep, seems to do the trick!
I'm assuming I'll get this fix through a future pull request, and am
not applying the patch as-is. Just FYI.
Linus
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web