Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm/damon/core: disallow max < min damos filter range arguments commit" failed to apply to 7.3-stable tree

PATCH Sasha Levin 2 participants 4 messages Nov 7

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 1bfb9384ae0ed52d61eb601b655014b7815ff849
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 1bfb9384ae0ed52d61eb601b655014b7815ff849 Mon Sep 17 00:00:00 2001
From: SJ Park <[email protected]>
Date: Mon, 14 Sep 2026 07:23:21 -0700
Subject: [PATCH] mm/damon/core: disallow max < min damos filter range
arguments commit

damos_commit_filter_arg() receives range arguments for a few types of DAMOS filters. It allows any range including max < min range. It is fine for the logic, but makes no sense to support it. Actually DAMON sysfs interface is doing the validation on its own. To avoid duplicated validations in multiple DAMON API callers, it would be better to do the validation in the core layer. Add a validation of the given range.

---
 mm/damon/core.c | 6 ++++++
 1 file changed, 6 insertions(+)
mm/damon/core.c +6 -0
index 1932a50252079..5fdacb9dcee5f 100644
@@ -1325,15 +1325,21 @@ static int damos_commit_filter_arg(
 		dst->memcg_id = src->memcg_id;
 		break;
 	case DAMOS_FILTER_TYPE_ADDR:
+		if (src->addr_range.end < src->addr_range.start)
+			return -EINVAL;
 		dst->addr_range = src->addr_range;
 		break;
 	case DAMOS_FILTER_TYPE_TARGET:
 		dst->target_idx = src->target_idx;
 		break;
 	case DAMOS_FILTER_TYPE_HUGEPAGE_SIZE:
+		if (src->sz_range.max < src->sz_range.min)
+			return -EINVAL;
 		dst->sz_range = src->sz_range;
 		break;
 	case DAMOS_FILTER_TYPE_PROBE_HITS_WSUM:
+		if (src->range_max < src->range_min)
+			return -EINVAL;
 		dst->range_min = src->range_min;
 		dst->range_max = src->range_max;
 		break;
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 32 lines · On Sat, 7 Nov 2026 05:04:27 -0500 Sasha Levin <[email protected]> wrote:

The patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 1bfb9384ae0ed52d61eb601b655014b7815ff849
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 1bfb9384ae0ed52d61eb601b655014b7815ff849 Mon Sep 17 00:00:00 2001

From: SJ Park <[email protected]>
Date: Mon, 14 Sep 2026 07:23:21 -0700
Subject: [PATCH] mm/damon/core: disallow max < min damos filter range
arguments commit

damos_commit_filter_arg() receives range arguments for a few types of DAMOS filters. It allows any range including max < min range. It is fine for the logic, but makes no sense to support it. Actually DAMON sysfs interface is doing the validation on its own. To avoid duplicated validations in multiple DAMON API callers, it would be better to do the validation in the core layer. Add a validation of the given range.

Quoted 7 lines

Including this, five DAMON patch cherry-pick failures [1,2,3,4] for 7.3.y are reported last night

The patchex except the last one [4] don't Cc: stable@ and look like not essential hotfixes.

Those are refactoring [1,2] or a very minor fix [3] that doesn't really impact users. Those are not built in porting-friendly way because those were not meant to be hotfixes. To port those, no small amount of refactoring or porting of more dependencies are expected.

I don't mind porting non-Cc: stable@ DAMON patches to stable kernels. And I'm happy to help doing that. But I'm not quite sure if this is indeed what you want, or picked by a mistake. Could you please confirm?

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]
[3] https://lore.kernel.org/[email protected]
[4] https://lore.kernel.org/[email protected]

Thanks,
SJ

[...]

maintainer
#2 lore raw
Quoted 48 lines · On Sat, 7 Nov 2026 09:36:36 -0800 SJ Park <[email protected]> wrote:
Quoted 32 lines · On Sat, 7 Nov 2026 05:04:27 -0500 Sasha Levin <[email protected]> wrote:

The patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 1bfb9384ae0ed52d61eb601b655014b7815ff849
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 1bfb9384ae0ed52d61eb601b655014b7815ff849 Mon Sep 17 00:00:00 2001

From: SJ Park <[email protected]>
Date: Mon, 14 Sep 2026 07:23:21 -0700
Subject: [PATCH] mm/damon/core: disallow max < min damos filter range
arguments commit

damos_commit_filter_arg() receives range arguments for a few types of DAMOS filters. It allows any range including max < min range. It is fine for the logic, but makes no sense to support it. Actually DAMON sysfs interface is doing the validation on its own. To avoid duplicated validations in multiple DAMON API callers, it would be better to do the validation in the core layer. Add a validation of the given range.

Quoted 7 lines

Including this, five DAMON patch cherry-pick failures [1,2,3,4] for 7.3.y are reported last night

The patchex except the last one [4] don't Cc: stable@ and look like not essential hotfixes.

Quoted 8 lines

Those are refactoring [1,2] or a very minor fix [3] that doesn't really impact users. Those are not built in porting-friendly way because those were not meant to be hotfixes. To port those, no small amount of refactoring or porting of more dependencies are expected.

I don't mind porting non-Cc: stable@ DAMON patches to stable kernels. And I'm happy to help doing that. But I'm not quite sure if this is indeed what you want, or picked by a mistake. Could you please confirm?

TL;DR: The four patches wrongly have Cc: stable@ tags. Let's ignore these.

I just found mainline commits for those patches do have Cc: stable@.

The patches I posted [1] don't have Cc: stable@. But Cc: stable@ tags are added to the patches inside mm.git. Apparently because I posted those as a part of a series that have both Cc:stable@ and non-Cc:stable@ patches. I shouldn't mixed those. Refer to other thread [2] of the same finding for more details.

And because they don't have Fixes:, seems it was tried to be applied to entire stable kernels. I show similar cherry-pick failure results from these patches. Sorry again for this complicated situation.

So, I'd suggest to not add this and three more cherry-pick failed patches [1,2,3] to stable series. There are two more non-Cc:stable patches in the series. Apparently those might also merged into the mainline with the wrong Cc:stable@ tags. Hence those may also be tried to be applied to stable kernels.

In lucky cases, those may failed like this. We can simply ignore those. If some of those are unluckily successfully cherry-picked, and if those don't make some test failures, maybe we could simply keep those.

Let me know if you'd prefer just adding those, or finding and dropping those wrongly applied ones from series before released. I could also help in any case.

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]

Quoted 7 lines

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]
[3] https://lore.kernel.org/[email protected]
[4] https://lore.kernel.org/[email protected]

Quoted 5 lines

Thanks,
SJ

[...]

Thanks,
SJ

maintainer
#3 lore raw

[...]

Quoted 3 lines

Let me know if you'd prefer just adding those, or finding and dropping those wrongly applied ones from series before released. I could also help in any case.

Maybe I could identify stable-rc patches that don't have 'Fixes:' tag as wrongly applied ones. I will find those from current stable-rc trees and request dropping those.

Thanks,
SJ

[...]