mbox series

[PATCHSET,v2,0/2] xfs: constify dotdot global variable

Message ID 164694922267.1119724.17942999738634110525.stgit@magnolia (mailing list archive)
Headers show
Series xfs: constify dotdot global variable | expand

Message

Darrick J. Wong March 10, 2022, 9:53 p.m. UTC
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(-)