Skip to content

mm/filemap: mark lockless accesses to mapping->nrpages - #1422

Closed
ghost wants to merge 1 commit into
linus-master_basefrom
series/1183287=>linus-master
Closed

ghost wants to merge 1 commit into
linus-master_basefrom
series/1183287=>linus-master

Conversation

@ghost

@ghost ghost commented Oct 11, 2026

Copy link
Copy Markdown

Pull request for series with
subject: mm/filemap: mark lockless accesses to mapping->nrpages
version: 1
url: https://patchwork.kernel.org/series/1183287/

@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 3857c2f
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: d5b6dc3
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from b2f6f5c to 683a9dc Compare October 11, 2026 18:25
@ghost ghost added V1-ci-fail and removed V1-ci-pass labels Oct 12, 2026
@ghost
ghost force-pushed the linus-master_base branch from ec9266e to 2e69118 Compare October 12, 2026 12:20
@ghost

ghost commented Oct 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 24a19b9
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 683a9dc to cf72e02 Compare October 12, 2026 12:29
@ghost
ghost force-pushed the linus-master_base branch from 2e69118 to 3cdd51f Compare October 14, 2026 11:11
@ghost

ghost commented Oct 14, 2026

Copy link
Copy Markdown
Author

Upstream branch: 4056b3c
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from cf72e02 to 8af35c2 Compare October 14, 2026 11:19
@ghost
ghost force-pushed the linus-master_base branch from 3cdd51f to e6ca2c1 Compare October 14, 2026 15:40
@ghost

ghost commented Oct 14, 2026

Copy link
Copy Markdown
Author

Upstream branch: 0fcb05b
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 8af35c2 to 5dbca04 Compare October 14, 2026 15:48
@ghost
ghost force-pushed the linus-master_base branch from e6ca2c1 to 3d027d5 Compare October 17, 2026 03:32
@ghost

ghost commented Oct 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 58161ea
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 5dbca04 to c476e71 Compare October 17, 2026 03:41
@ghost
ghost force-pushed the linus-master_base branch from 3d027d5 to 90ea7e4 Compare October 19, 2026 00:00
@ghost

ghost commented Oct 19, 2026

Copy link
Copy Markdown
Author

Upstream branch: c03c1a1
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from c476e71 to fb6153f Compare October 19, 2026 00:09
@ghost ghost added V1-ci-pass and removed V1-ci-fail labels Oct 19, 2026
@ghost
ghost force-pushed the linus-master_base branch from 90ea7e4 to 435b194 Compare October 22, 2026 07:21
@ghost

ghost commented Oct 22, 2026

Copy link
Copy Markdown
Author

Upstream branch: 7be4bc5
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from fb6153f to a70412b Compare October 22, 2026 07:58
@ghost
ghost force-pushed the linus-master_base branch from 5d84576 to 6582ed2 Compare October 26, 2026 18:11
@ghost

ghost commented Oct 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: fb2c3f4
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 5dc9606 to e38f235 Compare October 26, 2026 18:58
@ghost
ghost force-pushed the linus-master_base branch from 6582ed2 to b3a1abc Compare October 26, 2026 23:55
@ghost

ghost commented Oct 27, 2026

Copy link
Copy Markdown
Author

Upstream branch: d135ab4
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from e38f235 to d64b46d Compare October 27, 2026 00:21
@ghost
ghost force-pushed the linus-master_base branch from b3a1abc to 712496f Compare October 28, 2026 23:34
@ghost

ghost commented Oct 29, 2026

Copy link
Copy Markdown
Author

Upstream branch: c339f40
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from d64b46d to bcefe0e Compare October 29, 2026 00:01
@ghost
ghost force-pushed the linus-master_base branch from 712496f to a186880 Compare October 30, 2026 13:52
@ghost

ghost commented Oct 30, 2026

Copy link
Copy Markdown
Author

Upstream branch: d89e1d1
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from bcefe0e to 752c4b3 Compare October 30, 2026 14:53
@ghost
ghost force-pushed the linus-master_base branch from a186880 to 46206a3 Compare November 2, 2026 17:14
@ghost

ghost commented Nov 2, 2026

Copy link
Copy Markdown
Author

Upstream branch: 6628e7d
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 752c4b3 to 4d4eaf0 Compare November 2, 2026 18:03
@ghost
ghost force-pushed the linus-master_base branch from 46206a3 to 220bd96 Compare November 3, 2026 23:41
@ghost

ghost commented Nov 4, 2026

Copy link
Copy Markdown
Author

Upstream branch: 05441d6
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 4d4eaf0 to ddb7184 Compare November 4, 2026 00:14
@ghost
ghost force-pushed the linus-master_base branch from 220bd96 to 6c4625e Compare November 6, 2026 08:02
@ghost

ghost commented Nov 6, 2026

Copy link
Copy Markdown
Author

Upstream branch: f66469d
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from ddb7184 to c26e55c Compare November 6, 2026 08:54
@ghost
ghost force-pushed the linus-master_base branch from 6c4625e to c7f678d Compare November 7, 2026 03:08
@ghost

ghost commented Nov 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: d487237
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from c26e55c to 8ac8c1f Compare November 7, 2026 03:50
@ghost
ghost force-pushed the linus-master_base branch from c7f678d to 6aa6cd1 Compare November 10, 2026 07:53
mapping->nrpages is updated under the i_pages lock but is read locklessly
as a cheap "anything cached?" hint, e.g. in invalidate_bdev() and
mapping_needs_writeback(). KCSAN reports the race:

  BUG: KCSAN: data-race in __filemap_add_folio / invalidate_bdev

  read-write to 0xffff8881004c4178 of 8 bytes by task 3600 on cpu 0:
   __filemap_add_folio+0x6b7/0x910 mm/filemap.c:919
   filemap_add_folio+0x1cd/0x380
   page_cache_ra_unbounded+0x1a4/0x3a0
   ...
   blkdev_read_iter+0x21e/0x2d0
  read to 0xffff8881004c4178 of 8 bytes by task 3601 on cpu 1:
   invalidate_bdev+0x25/0x70 block/bdev.c:98
   ext4_fill_super+0x2ccb/0x37b0

The same counter also races with filemap_write_and_wait_range() through
mapping_needs_writeback().

The race is benign: a stale value only makes the caller do or skip a
harmless invalidate/flush pass. Annotate the readers with READ_ONCE() and
the writers in filemap with WRITE_ONCE().

Reported-by: syzbot+e0624b5bf72b99131402@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e0624b5bf72b99131402
Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: b3dfbde
series: https://patchwork.kernel.org/series/1183287/
version: 1

@ghost
ghost force-pushed the series/1183287=>linus-master branch from 8ac8c1f to 563cce1 Compare November 10, 2026 08:23
@ghost

ghost commented Nov 10, 2026

Copy link
Copy Markdown
Author

At least one diff in series https://patchwork.kernel.org/series/1183287/ irrelevant now for [{'archived': False, 'project': 241}] search patterns

@ghost ghost closed this Nov 10, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant