Skip to contentSkip to conversation

makedumpfile: a feature question about filtering

DISCUSSION piliu 2 participants 8 messages Sep 8, 2020 – Sep 16, 2020

Subsystems (2)
lore
Share & tools
lore

piliu

author
#0 lore raw

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

This somewhat overlaps with the function of crash utility. And I want to know if this feature is acceptable in upstream.

Any comment and suggestion?

Thanks,
Pingfan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw

Hi Pingfan,

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 4 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

How many offsets/sizes will be required to walk all tasks? If kernel maintainers accept it, I will not oppose that feature..

(or it would be simpler to mark the pages something special when allocating, but I don't feel like it's easy to change kernel to do so.)

Thanks,
Kazu

Quoted 8 lines

This somewhat overlaps with the function of crash utility. And I want to know if this feature is acceptable in upstream.

Any comment and suggestion?

Thanks,
Pingfan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#2 lore raw
Quoted 12 lines · HAGIO KAZUHITO(萩尾 一仁)

Hi Pingfan,

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 1 line
Quoted 5 lines
Quoted 3 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

How many offsets/sizes will be required to walk all tasks?

At present, I think only the info "arg_start, arg_end, env_start, env_end" in mm_struct are required.

Quoted 1 line

If kernel maintainers accept it, I will not oppose that feature..

OK, I will start with kernel side as the first step.

Quoted 3 lines

(or it would be simpler to mark the pages something special when allocating, but I don't feel like it's easy to change kernel to do so.)

Yes, I agree. From kernel side, the page is a normal user space page, there should not be exception.

Thanks,
Pingfan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw

-----Original Message-----

Quoted 13 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 12 lines

Hi Pingfan,

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

How many offsets/sizes will be required to walk all tasks?

At present, I think only the info "arg_start, arg_end, env_start, env_end" in mm_struct are required.

ah what I wanted to ask mainly was the number of the offsets/sizes used to walk through all (user) tasks in a system, because makedumpfile cannot get to a task's arg_start only with OFFSET(mm_struct.arg_start). Is it easy enough to do it only with several vmcoreinfo entries?

Thanks,
Kazu

Quoted 10 lines
Quoted 1 line

If kernel maintainers accept it, I will not oppose that feature..

OK, I will start with kernel side as the first step.

Quoted 3 lines

(or it would be simpler to mark the pages something special when allocating, but I don't feel like it's easy to change kernel to do so.)

Yes, I agree. From kernel side, the page is a normal user space page, there should not be exception.

Thanks,
Pingfan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#4 lore raw
Quoted 18 lines · HAGIO KAZUHITO(萩尾 一仁)

-----Original Message-----

Quoted 17 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 16 lines

Hi Pingfan,

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 4 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

How many offsets/sizes will be required to walk all tasks?

At present, I think only the info "arg_start, arg_end, env_start, env_end" in mm_struct are required.

ah what I wanted to ask mainly was the number of the offsets/sizes used to walk through all (user) tasks in a system, because makedumpfile cannot get to a task's arg_start only with OFFSET(mm_struct.arg_start). Is it easy enough to do it only with several vmcoreinfo entries?

Yes, it is. Iterating over tasks requires to expose OFFSET(mm_struct.mmlist, and &init_mm. Then for each mm_struct, we need an access to "arg_start, arg_end, env_start,env_end"

Thanks,
Pingfan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#5 lore raw

-----Original Message-----

Quoted 23 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 22 lines

-----Original Message-----

Quoted 20 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 12 lines

Hi Pingfan,

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 1 line
Quoted 5 lines
Quoted 3 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

How many offsets/sizes will be required to walk all tasks?

At present, I think only the info "arg_start, arg_end, env_start, env_end" in mm_struct are required.

Quoted 7 lines
Quoted 4 lines

ah what I wanted to ask mainly was the number of the offsets/sizes used to walk through all (user) tasks in a system, because makedumpfile cannot get to a task's arg_start only with OFFSET(mm_struct.arg_start). Is it easy enough to do it only with several vmcoreinfo entries?

Yes, it is. Iterating over tasks requires to expose OFFSET(mm_struct.mmlist, and &init_mm. Then for each mm_struct, we need an access to "arg_start, arg_end, env_start,env_end"

Hmm, but a Fedora 32 machine has an empty init_mm.mmlist. (because of no used swap?)

crash> p init_mm.mmlist
$1 = {
next = 0xffffffff826ee200 <init_mm+160>,
prev = 0xffffffff826ee200 <init_mm+160>
}
crash> swap
SWAP_INFO_STRUCT TYPE SIZE USED PCT PRI FILENAME
ffff8badb5385a00 PARTITION 4153340k 0k 0% -2 /dev/dm-1

I might be still missing something.

Thanks,
Kazu
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#6 lore raw
Quoted 28 lines · HAGIO KAZUHITO(萩尾 一仁)

-----Original Message-----

Quoted 27 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 26 lines

-----Original Message-----

Quoted 13 lines · HAGIO KAZUHITO(萩尾 一仁)
Quoted 12 lines

Hi Pingfan,

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

How many offsets/sizes will be required to walk all tasks?

At present, I think only the info "arg_start, arg_end, env_start, env_end" in mm_struct are required.

ah what I wanted to ask mainly was the number of the offsets/sizes used to walk through all (user) tasks in a system, because makedumpfile cannot get to a task's arg_start only with OFFSET(mm_struct.arg_start). Is it easy enough to do it only with several vmcoreinfo entries?

Quoted 6 lines
Quoted 3 lines

Yes, it is. Iterating over tasks requires to expose OFFSET(mm_struct.mmlist, and &init_mm. Then for each mm_struct, we need an access to "arg_start, arg_end, env_start,env_end"

Hmm, but a Fedora 32 machine has an empty init_mm.mmlist. (because of no used swap?)

Aha, sorry that I made a mistake and mmlist is not used to organize all the mm any more.

In order to access all mm_strcut in the system, init_task.tasks linked-list should be exposed, and for each task we can access its mm_struct by OFFSET(task_struct.mm), then OFFSET(mm_struct.arg_start).

Quoted 11 lines

crash> p init_mm.mmlist
$1 = {
next = 0xffffffff826ee200 <init_mm+160>,
prev = 0xffffffff826ee200 <init_mm+160>
}
crash> swap
SWAP_INFO_STRUCT TYPE SIZE USED PCT PRI FILENAME
ffff8badb5385a00 PARTITION 4153340k 0k 0% -2 /dev/dm-1

I might be still missing something.

You are right. And could you foresee any problem with my new try?

Thanks,
Pingfan

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#7 lore raw

Hi Pingfan,

-----Original Message-----

Quoted 44 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 10 lines
Quoted 10 lines

-----Original Message-----

Quoted 4 lines

Hello,

There is an appeal which only wants to save some user page including env and args pages, and discards the other user space pages.

I understand that it's helpful to get them even with -d 31 for crash's "ps -a" option..

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

To achieve this feature, mm_struct's members "arg_start, arg_end, env_start, env_end;" should be accessed. So we need to export mm_struct and init_mm through vmcore.

How many offsets/sizes will be required to walk all tasks?

At present, I think only the info "arg_start, arg_end, env_start, env_end" in mm_struct are required.

ah what I wanted to ask mainly was the number of the offsets/sizes used to walk through all (user) tasks in a system, because makedumpfile cannot get to a task's arg_start only with OFFSET(mm_struct.arg_start). Is it easy enough to do it only with several vmcoreinfo entries?

Quoted 6 lines
Quoted 3 lines

Yes, it is. Iterating over tasks requires to expose OFFSET(mm_struct.mmlist, and &init_mm. Then for each mm_struct, we need an access to "arg_start, arg_end, env_start,env_end"

Hmm, but a Fedora 32 machine has an empty init_mm.mmlist. (because of no used swap?)

Aha, sorry that I made a mistake and mmlist is not used to organize all the mm any more.

In order to access all mm_strcut in the system, init_task.tasks linked-list should be exposed, and for each task we can access its mm_struct by OFFSET(task_struct.mm), then OFFSET(mm_struct.arg_start).

Quoted 10 lines

crash> p init_mm.mmlist
$1 = {
next = 0xffffffff826ee200 <init_mm+160>,
prev = 0xffffffff826ee200 <init_mm+160>
}
crash> swap
SWAP_INFO_STRUCT TYPE SIZE USED PCT PRI FILENAME
ffff8badb5385a00 PARTITION 4153340k 0k 0% -2 /dev/dm-1

Quoted 2 lines
Quoted 1 line

I might be still missing something.

You are right. And could you foresee any problem with my new try?

as far as I took a glance at copy_process(), it looks good.

                if (thread_group_leader(p)) {
                        ...
                        list_add_tail_rcu(&p->tasks, &init_task.tasks);

Thanks,
Kazu

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec