linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET 0/2] xfs: constify dotdot global variable
@ 2022-03-09 19:22 Darrick J. Wong
  2022-03-09 19:22 ` [PATCH 1/2] xfs: constify the name argument to various directory functions Darrick J. Wong
  2022-03-09 19:22 ` [PATCH 2/2] xfs: constify xfs_name_dotdot Darrick J. Wong
  0 siblings, 2 replies; 8+ messages in thread
From: Darrick J. Wong @ 2022-03-09 19:22 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs

Hi all,

I was auditing the code base when I noticed that the xfs_name_dotdot
variable is both global and mutable.  In theory, someone could change
the contents of that variable (either through misuse or by exploiting a
kernel bug) which would then break the directory code, so let's shut
down that attack surface by making it const.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=constify-dotdot-5.18
---
 fs/xfs/libxfs/xfs_dir2.c      |   18 +++++++++++-------
 fs/xfs/libxfs/xfs_dir2.h      |    6 +++---
 fs/xfs/libxfs/xfs_dir2_priv.h |    5 +++--
 fs/xfs/scrub/parent.c         |    6 ++++--
 fs/xfs/xfs_export.c           |    3 ++-
 5 files changed, 23 insertions(+), 15 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCHSET v2 0/2] xfs: constify dotdot global variable
@ 2022-03-10 21:53 Darrick J. Wong
  2022-03-10 21:53 ` [PATCH 2/2] xfs: constify xfs_name_dotdot Darrick J. Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2022-03-10 21:53 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs

Hi all,

I was auditing the code base when I noticed that the xfs_name_dotdot
variable is both global and mutable.  In theory, someone could change
the contents of that variable (either through misuse or by exploiting a
kernel bug) which would then break the directory code, so let's shut
down that attack surface by making it const.

v2: make the lookup function name argument const, thereby avoiding
    clunkiness in the second patch

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=constify-dotdot-5.18
---
 fs/xfs/libxfs/xfs_dir2.c      |   36 ++++++++++++++++++++----------------
 fs/xfs/libxfs/xfs_dir2.h      |    8 ++++----
 fs/xfs/libxfs/xfs_dir2_priv.h |    5 +++--
 fs/xfs/xfs_inode.c            |    6 +++---
 fs/xfs/xfs_inode.h            |    2 +-
 fs/xfs/xfs_trace.h            |    4 ++--
 6 files changed, 33 insertions(+), 28 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-10 22:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09 19:22 [PATCHSET 0/2] xfs: constify dotdot global variable Darrick J. Wong
2022-03-09 19:22 ` [PATCH 1/2] xfs: constify the name argument to various directory functions Darrick J. Wong
2022-03-09 22:06   ` Dave Chinner
2022-03-09 19:22 ` [PATCH 2/2] xfs: constify xfs_name_dotdot Darrick J. Wong
2022-03-09 22:32   ` Dave Chinner
2022-03-09 23:27     ` Darrick J. Wong
2022-03-10 21:53 [PATCHSET v2 0/2] xfs: constify dotdot global variable Darrick J. Wong
2022-03-10 21:53 ` [PATCH 2/2] xfs: constify xfs_name_dotdot Darrick J. Wong
2022-03-10 22:26   ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).