All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Chen Huang <chenhuang5@huawei.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Randy Dunlap <rdunlap@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	linux-mm <linux-mm@kvack.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] arm64: an infinite loop in generic_perform_write()
Date: Thu, 24 Jun 2021 12:15:46 +0100	[thread overview]
Message-ID: <YNRpYli/5/GWvaTT@casper.infradead.org> (raw)
In-Reply-To: <YNQuZ8ykN7aR+1MP@infradead.org>

On Thu, Jun 24, 2021 at 08:04:07AM +0100, Christoph Hellwig wrote:
> On Thu, Jun 24, 2021 at 04:24:46AM +0100, Matthew Wilcox wrote:
> > On Thu, Jun 24, 2021 at 11:10:41AM +0800, Chen Huang wrote:
> > > In userspace, I perform such operation:
> > > 
> > >  	fd = open("/tmp/test", O_RDWR | O_SYNC);
> > >         access_address = (char *)mmap(NULL, uio_size, PROT_READ, MAP_SHARED, uio_fd, 0);
> > >         ret = write(fd, access_address + 2, sizeof(long));
> > 
> > ... you know that accessing this at unaligned offsets isn't going to
> > work.  It's completely meaningless.  Why are you trying to do it?
> 
> We still should not cause an infinite loop in kernel space due to a
> a userspace programmer error.

They're running as root and they've mapped some device memory.  We can't
save them from themself.  Imagine if they'd done this to the NVMe BAR.

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Chen Huang <chenhuang5@huawei.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Randy Dunlap <rdunlap@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	linux-mm <linux-mm@kvack.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] arm64: an infinite loop in generic_perform_write()
Date: Thu, 24 Jun 2021 12:15:46 +0100	[thread overview]
Message-ID: <YNRpYli/5/GWvaTT@casper.infradead.org> (raw)
In-Reply-To: <YNQuZ8ykN7aR+1MP@infradead.org>

On Thu, Jun 24, 2021 at 08:04:07AM +0100, Christoph Hellwig wrote:
> On Thu, Jun 24, 2021 at 04:24:46AM +0100, Matthew Wilcox wrote:
> > On Thu, Jun 24, 2021 at 11:10:41AM +0800, Chen Huang wrote:
> > > In userspace, I perform such operation:
> > > 
> > >  	fd = open("/tmp/test", O_RDWR | O_SYNC);
> > >         access_address = (char *)mmap(NULL, uio_size, PROT_READ, MAP_SHARED, uio_fd, 0);
> > >         ret = write(fd, access_address + 2, sizeof(long));
> > 
> > ... you know that accessing this at unaligned offsets isn't going to
> > work.  It's completely meaningless.  Why are you trying to do it?
> 
> We still should not cause an infinite loop in kernel space due to a
> a userspace programmer error.

They're running as root and they've mapped some device memory.  We can't
save them from themself.  Imagine if they'd done this to the NVMe BAR.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-24 11:17 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  2:39 [BUG] arm64: an infinite loop in generic_perform_write() Chen Huang
2021-06-23  2:39 ` Chen Huang
2021-06-23  2:50 ` Al Viro
2021-06-23  2:50   ` Al Viro
2021-06-23  3:24   ` Xiaoming Ni
2021-06-23  3:24     ` Xiaoming Ni
2021-06-23  4:27     ` Al Viro
2021-06-23  4:27       ` Al Viro
2021-06-23  9:32       ` Catalin Marinas
2021-06-23  9:32         ` Catalin Marinas
2021-06-23 11:51         ` Matthew Wilcox
2021-06-23 11:51           ` Matthew Wilcox
2021-06-23 13:04         ` Al Viro
2021-06-23 13:04           ` Al Viro
2021-06-23 13:22 ` Mark Rutland
2021-06-23 13:22   ` Mark Rutland
2021-06-24  3:10   ` Chen Huang
2021-06-24  3:10     ` Chen Huang
2021-06-24  3:24     ` Matthew Wilcox
2021-06-24  3:24       ` Matthew Wilcox
2021-06-24  3:52       ` Chen Huang
2021-06-24  3:52         ` Chen Huang
2021-06-24  7:04       ` Christoph Hellwig
2021-06-24  7:04         ` Christoph Hellwig
2021-06-24 11:15         ` Matthew Wilcox [this message]
2021-06-24 11:15           ` Matthew Wilcox
2021-06-24 13:22           ` Robin Murphy
2021-06-24 13:22             ` Robin Murphy
2021-06-24 16:27             ` Al Viro
2021-06-24 16:27               ` Al Viro
2021-06-24 16:38               ` Robin Murphy
2021-06-24 16:38                 ` Robin Murphy
2021-06-24 16:39                 ` Al Viro
2021-06-24 16:39                   ` Al Viro
2021-06-24 17:24                   ` Robin Murphy
2021-06-24 17:24                     ` Robin Murphy
2021-06-24 18:55               ` Catalin Marinas
2021-06-24 18:55                 ` Catalin Marinas
2021-06-24 20:36                 ` Robin Murphy
2021-06-24 20:36                   ` Robin Murphy
2021-06-25 10:39                   ` Catalin Marinas
2021-06-25 10:39                     ` Catalin Marinas
2021-06-28 16:22                     ` Robin Murphy
2021-06-28 16:22                       ` Robin Murphy
2021-06-29  8:30                       ` Catalin Marinas
2021-06-29  8:30                         ` Catalin Marinas
2021-06-29 10:01                         ` Robin Murphy
2021-06-29 10:01                           ` Robin Murphy
2021-07-06 17:50                       ` Catalin Marinas
2021-07-06 17:50                         ` Catalin Marinas
2021-07-06 19:15                         ` Robin Murphy
2021-07-06 19:15                           ` Robin Murphy
2021-07-07  9:55                           ` David Laight
2021-07-07  9:55                             ` David Laight
2021-07-07 11:04                             ` Robin Murphy
2021-07-07 11:04                               ` Robin Murphy
2021-07-07 12:50                           ` Catalin Marinas
2021-07-07 12:50                             ` Catalin Marinas
2021-06-24 15:09           ` Catalin Marinas
2021-06-24 15:09             ` Catalin Marinas
2021-06-24 16:17             ` Al Viro
2021-06-24 16:17               ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNRpYli/5/GWvaTT@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuang5@huawei.com \
    --cc=hch@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.