On 20.08.2026 4:39 AM, Christian Brauner wrote:
The dump_skip_to() helper calculates a relative skip based on the
absolute positon of the coredump:

        cprm->to_skip = pos - cprm->pos;

That's easy to mess up for callers and one already did. This risk
endless zero PAGE_SIZE loops or overwriting already written coredump
data thereby corrupting the dump.

I don't think skipping backwards has any meaning. So warn and refuse.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Tested-by: R Nageswara Sastry <[email protected]>

System: ppc64le LPAR (IBM POWER), Linux 7.3-rc2
---
  fs/coredump.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/fs/coredump.c b/fs/coredump.c
index e68a76ff92a3..ac4e922c9cb9 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1261,6 +1261,8 @@ EXPORT_SYMBOL(dump_emit);
void dump_skip_to(struct coredump_params *cprm, unsigned long pos)
  {
+       if (WARN_ON_ONCE(pos < cprm->pos))
+               return;
        cprm->to_skip = pos - cprm->pos;
  }
  EXPORT_SYMBOL(dump_skip_to);

--
Thanks and Regards
R.Nageswara Sastry


Reply via email to