All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] fs, xfs atomic_t to refcount_t conversions version 2
@ 2017-03-01  8:47 Elena Reshetova
  2017-03-01  8:47 ` [PATCH 1/5] fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to refcount_t Elena Reshetova
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Elena Reshetova @ 2017-03-01  8:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-xfs, peterz, gregkh, darrick.wong, david, Elena Reshetova

changes in v2:

 * removed two patches that actually caused problems in testing and 
 there didn't seem to be a resonable way to convert them to refcount_t 
 based on all the triggered issues.
 * run xfstests with TEST and SCRATCH partitions enabled, XFS_DEBUG on,
 and WARNs on refcount_t API on. No issues found in the log upon execution. 
 Some random test failures (based on different runs) and stress tests do not always
 pass, but again, no issues on refcounts noticed anywhere. 


Now when new refcount_t type and API are finally merged
(see include/linux/refcount.h), the following
patches convert various refcounters in the fs/xfs susystem from atomic_t
to refcount_t. By doing this we prevent intentional or accidental
underflows or overflows that can led to use-after-free vulnerabilities.

The below patches are fully independent and can be cherry-picked separately.
Since we convert all kernel subsystems in the same fashion, resulting
in about 300 patches, we have to group them for sending at least in some
fashion to be manageable. Please excuse the long cc list.

Elena Reshetova (5):
  fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_efi_log_item.efi_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t
  fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_rui_log_item.rui_refcount from atomic_t to
    refcount_t

 fs/xfs/xfs_bmap_item.c     |  4 ++--
 fs/xfs/xfs_bmap_item.h     |  4 +++-
 fs/xfs/xfs_extfree_item.c  |  4 ++--
 fs/xfs/xfs_extfree_item.h  |  4 +++-
 fs/xfs/xfs_log.c           | 10 +++++-----
 fs/xfs/xfs_log_priv.h      |  4 +++-
 fs/xfs/xfs_refcount_item.c |  4 ++--
 fs/xfs/xfs_refcount_item.h |  4 +++-
 fs/xfs/xfs_rmap_item.c     |  4 ++--
 fs/xfs/xfs_rmap_item.h     |  4 +++-
 10 files changed, 28 insertions(+), 18 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH 0/5] fs, xfs refcount conversions
@ 2017-03-08  8:53 Elena Reshetova
  2017-03-08  8:53 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to refcount_t Elena Reshetova
  0 siblings, 1 reply; 12+ messages in thread
From: Elena Reshetova @ 2017-03-08  8:53 UTC (permalink / raw)
  To: darrick.wong; +Cc: linux-kernel, linux-xfs, Elena Reshetova

v3:
 * fixed header file inclusion

Now when new refcount_t type and API are finally merged
(see include/linux/refcount.h), the following
patches convert various refcounters in the xfs susystem from atomic_t
to refcount_t. By doing this we prevent intentional or accidental
underflows or overflows that can led to use-after-free vulnerabilities.


Elena Reshetova (5):
  fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_efi_log_item.efi_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t
  fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_rui_log_item.rui_refcount from atomic_t to
    refcount_t

 fs/xfs/xfs_bmap_item.c     |  4 ++--
 fs/xfs/xfs_bmap_item.h     |  2 +-
 fs/xfs/xfs_extfree_item.c  |  4 ++--
 fs/xfs/xfs_extfree_item.h  |  2 +-
 fs/xfs/xfs_linux.h         |  1 +
 fs/xfs/xfs_log.c           | 10 +++++-----
 fs/xfs/xfs_log_priv.h      |  2 +-
 fs/xfs/xfs_refcount_item.c |  4 ++--
 fs/xfs/xfs_refcount_item.h |  2 +-
 fs/xfs/xfs_rmap_item.c     |  4 ++--
 fs/xfs/xfs_rmap_item.h     |  2 +-
 11 files changed, 19 insertions(+), 18 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH 0/5] xfs refcount conversions
@ 2017-10-20 11:07 Elena Reshetova
  2017-10-20 11:07 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to refcount_t Elena Reshetova
  0 siblings, 1 reply; 12+ messages in thread
From: Elena Reshetova @ 2017-10-20 11:07 UTC (permalink / raw)
  To: darrick.wong; +Cc: linux-kernel, linux-xfs, peterz, keescook, Elena Reshetova

Note: our previous thread didn't finish in any conclusion, so
I am resending this now (rebased at latest linux-next) to revive
the discussion. refcount_t is slowly becoming a standard for
refcounters and we would really like to make all conversions
done where it is applicable.

******

This series, for xfs, replaces atomic_t reference
counters with the new refcount_t type and API (see include/linux/refcount.h).
By doing this we prevent intentional or accidental
underflows or overflows that can lead to use-after-free vulnerabilities.

The patches are fully independent and can be cherry-picked separately.
If there are no objections to the patches, please merge them via respective trees.

Elena Reshetova (5):
  fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_efi_log_item.efi_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t
  fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_rui_log_item.rui_refcount from atomic_t to
    refcount_t

 fs/xfs/xfs_bmap_item.c     |  6 +++---
 fs/xfs/xfs_bmap_item.h     |  2 +-
 fs/xfs/xfs_extfree_item.c  |  6 +++---
 fs/xfs/xfs_extfree_item.h  |  2 +-
 fs/xfs/xfs_linux.h         |  1 +
 fs/xfs/xfs_log.c           | 10 +++++-----
 fs/xfs/xfs_log_priv.h      |  2 +-
 fs/xfs/xfs_refcount_item.c |  6 +++---
 fs/xfs/xfs_refcount_item.h |  2 +-
 fs/xfs/xfs_rmap_item.c     |  6 +++---
 fs/xfs/xfs_rmap_item.h     |  2 +-
 11 files changed, 23 insertions(+), 22 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH 0/5] v2 xfs refcount conversions
@ 2017-11-29 11:37 Elena Reshetova
  2017-11-29 11:38 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to refcount_t Elena Reshetova
  0 siblings, 1 reply; 12+ messages in thread
From: Elena Reshetova @ 2017-11-29 11:37 UTC (permalink / raw)
  To: david
  Cc: darrick.wong, linux-kernel, linux-xfs, peterz, keescook, Elena Reshetova

Hi Dave,

Following our previous conversation I have updated each
patch with a highlight of potential problematic places
with regards to the memory ordering guarantees, as well
as link to the document I am working on to clarify the
matter.

While I didn't see any issues with these 5 particular
conversions, of course I don't understand code anywhere
good enough to make the final claim that "everything is
100% ok".

Please let me know what kind of other clarification or
anything is needed that can help you to make the needed
verification.

Best Regards,
Elena.



Changes in v2:
  - each patch now has a clarification on potential
    problematic places with regards to the memory ordering
    guarantees as well as reference to a hopefully soon to be
    merged more extensive documentation on the
    differences between atomic_t and refcount_t on ordering.
  - Rebase on linux-next master.


This series, for xfs, replaces atomic_t reference
counters with the new refcount_t type and API (see include/linux/refcount.h).
By doing this we prevent intentional or accidental
underflows or overflows that can lead to use-after-free vulnerabilities.

The patches are fully independent and can be cherry-picked separately.
If there are no objections to the patches, please merge them via respective trees.

Elena Reshetova (5):
  fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_efi_log_item.efi_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t
  fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to
    refcount_t
  fs, xfs: convert xfs_rui_log_item.rui_refcount from atomic_t to
    refcount_t

 fs/xfs/xfs_bmap_item.c     |  6 +++---
 fs/xfs/xfs_bmap_item.h     |  2 +-
 fs/xfs/xfs_extfree_item.c  |  6 +++---
 fs/xfs/xfs_extfree_item.h  |  2 +-
 fs/xfs/xfs_linux.h         |  1 +
 fs/xfs/xfs_log.c           | 10 +++++-----
 fs/xfs/xfs_log_priv.h      |  2 +-
 fs/xfs/xfs_refcount_item.c |  6 +++---
 fs/xfs/xfs_refcount_item.h |  2 +-
 fs/xfs/xfs_rmap_item.c     |  6 +++---
 fs/xfs/xfs_rmap_item.h     |  2 +-
 11 files changed, 23 insertions(+), 22 deletions(-)

-- 
2.7.4

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

end of thread, other threads:[~2017-11-29 11:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01  8:47 [PATCH 0/5] fs, xfs atomic_t to refcount_t conversions version 2 Elena Reshetova
2017-03-01  8:47 ` [PATCH 1/5] fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to refcount_t Elena Reshetova
2017-03-01  8:47 ` [PATCH 2/5] fs, xfs: convert xfs_efi_log_item.efi_refcount " Elena Reshetova
2017-03-01  8:47 ` [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref " Elena Reshetova
2017-03-01  8:47 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount " Elena Reshetova
2017-03-06 19:14   ` Darrick J. Wong
2017-03-07 17:33     ` Reshetova, Elena
2017-03-07 20:30       ` Darrick J. Wong
2017-03-01  8:47 ` [PATCH 5/5] fs, xfs: convert xfs_rui_log_item.rui_refcount " Elena Reshetova
2017-03-08  8:53 [PATCH 0/5] fs, xfs refcount conversions Elena Reshetova
2017-03-08  8:53 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to refcount_t Elena Reshetova
2017-10-20 11:07 [PATCH 0/5] xfs refcount conversions Elena Reshetova
2017-10-20 11:07 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to refcount_t Elena Reshetova
2017-11-29 11:37 [PATCH 0/5] v2 xfs refcount conversions Elena Reshetova
2017-11-29 11:38 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount from atomic_t to refcount_t Elena Reshetova

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.