Patch "jfs: Fix fortify moan in symlink" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    jfs: Fix fortify moan in symlink

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     jfs-fix-fortify-moan-in-symlink.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5c0cc762cc603ded5f6ae777ba8a07db94e9f092
Author: Dr. David Alan Gilbert <linux@xxxxxxxxxxx>
Date:   Sat Oct 22 21:39:14 2022 +0100

    jfs: Fix fortify moan in symlink
    
    [ Upstream commit ebe060369f8d6e4588b115f252bebf5ba4d64350 ]
    
    JFS has in jfs_incore.h:
    
          /* _inline may overflow into _inline_ea when needed */
          /* _inline_ea may overlay the last part of
           * file._xtroot if maxentry = XTROOTINITSLOT
           */
          union {
            struct {
              /* 128: inline symlink */
              unchar _inline[128];
              /* 128: inline extended attr */
              unchar _inline_ea[128];
            };
            unchar _inline_all[256];
    
    and currently the symlink code copies into _inline;
    if this is larger than 128 bytes it triggers a fortify warning of the
    form:
    
      memcpy: detected field-spanning write (size 132) of single field
         "ip->i_link" at fs/jfs/namei.c:950 (size 18446744073709551615)
    
    when it's actually OK.
    
    Copy it into _inline_all instead.
    
    Reported-by: syzbot+5fc38b2ddbbca7f5c680@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Dr. David Alan Gilbert <linux@xxxxxxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 9db4f5789c0e..4fbbf88435e6 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -946,7 +946,7 @@ static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip,
 	if (ssize <= IDATASIZE) {
 		ip->i_op = &jfs_fast_symlink_inode_operations;
 
-		ip->i_link = JFS_IP(ip)->i_inline;
+		ip->i_link = JFS_IP(ip)->i_inline_all;
 		memcpy(ip->i_link, name, ssize);
 		ip->i_size = ssize - 1;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux