commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 19/25: ext2fs: Poison pointers into dereferenced cache pages.


From: Samuel Thibault
Subject: [hurd] 19/25: ext2fs: Poison pointers into dereferenced cache pages.
Date: Mon, 24 Oct 2016 00:16:45 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 93ba74df1d6523ac49d5b227e30e1cfca930f7a9
Author: Justus Winter <address@hidden>
Date:   Sat Oct 8 18:41:02 2016 +0200

    ext2fs: Poison pointers into dereferenced cache pages.
    
    * ext2fs/ext2fs.h (disk_cache_block_deref): Replace with a macro that
    NULLs the given pointer.
    (dino_deref): Likewise.
    * ext2fs/pager.c (disk_cache_block_deref): Rename.
    * ext2fs/pokel.c (pokel_add): Adapt.
    (pokel_exec): Likewise.
---
 ext2fs/ext2fs.h | 8 ++++++--
 ext2fs/pager.c  | 2 +-
 ext2fs/pokel.c  | 6 +++---
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index c233ce0..afcd25c 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -271,7 +271,9 @@ extern pthread_cond_t disk_cache_reassociation;
 
 void *disk_cache_block_ref (block_t block);
 void disk_cache_block_ref_ptr (void *ptr);
-void disk_cache_block_deref (void *ptr);
+void _disk_cache_block_deref (void *ptr);
+#define disk_cache_block_deref(PTR)                             \
+  do { _disk_cache_block_deref (PTR); PTR = NULL; } while (0)
 int disk_cache_block_is_ref (block_t block);
 
 /* Our in-core copy of the super-block (pointer into the disk_cache).  */
@@ -412,12 +414,14 @@ dino_ref (ino_t inum)
 }
 
 EXT2FS_EI void
-dino_deref (struct ext2_inode *inode)
+_dino_deref (struct ext2_inode *inode)
 {
   ext2_debug ("(%p)", inode);
   disk_cache_block_deref (inode);
 }
 #endif /* Use extern inlines.  */
+#define dino_deref(INODE)                               \
+  do { _dino_deref (INODE); INODE = NULL; } while (0)
 
 /* ---------------------------------------------------------------- */
 /* inode.c */
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index 456b582..6a92682 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -1197,7 +1197,7 @@ disk_cache_block_ref_ptr (void *ptr)
 }
 
 void
-disk_cache_block_deref (void *ptr)
+_disk_cache_block_deref (void *ptr)
 {
   int index;
 
diff --git a/ext2fs/pokel.c b/ext2fs/pokel.c
index 3afb32e..53dc513 100644
--- a/ext2fs/pokel.c
+++ b/ext2fs/pokel.c
@@ -71,7 +71,7 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
        {
          if (pokel->image == disk_cache)
            for (vm_offset_t i = offset; i < end; i += block_size)
-             disk_cache_block_deref (disk_cache + i);
+             _disk_cache_block_deref (disk_cache + i);
 
          break;
        }
@@ -85,7 +85,7 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
              vm_offset_t i_begin = p_offs > offset ? p_offs : offset;
              vm_offset_t i_end = p_end < end ? p_end : end;
              for (vm_offset_t i = i_begin; i < i_end; i += block_size)
-               disk_cache_block_deref (disk_cache + i);
+               _disk_cache_block_deref (disk_cache + i);
            }
 
          ext2_debug ("extended 0x%x[%ul] to 0x%x[%ul]",
@@ -140,7 +140,7 @@ _pokel_exec (struct pokel *pokel, int sync, int wait)
          vm_offset_t begin = trunc_block (pl->offset);
          vm_offset_t end = round_block (pl->offset + pl->length);
          for (vm_offset_t i = begin; i != end; i += block_size)
-           disk_cache_block_deref (pokel->image + i);
+           _disk_cache_block_deref (pokel->image + i);
        }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]