Skip to contentSkip to conversation

coredump: Handle programs with spaces in COMM

PATCH Oleg Nesterov 3 participants 4 messages May 1, 2013 – May 9, 2013 3 messages not in the archive

lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Colin Walters
Quoted 4 lines · Zbigniew Jędrzejewski-Szmek
Quoted 3 lines · Colin Walters

This patch makes systemd-coredump handle processes that have whitespace in their COMM fields.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

fs/coredump.c when given %e (as systemd-coredump uses), will end up joining the process arguments into a string (along with the other fields), then will split the entire thing up on whitespace, and use it as the arguments to the coredump pipe handler.
---

That's a workaround for a bug in the kernel. I think it makes sense, but it'd be nice to fix the kernel too.

I wouldn't say this is bug... at least this is expected.

Sure, it is possible to rewrite format_corename/argv_split interaction, but this is a bit painful and I am not sure it worth the trouble.

Quoted 2 lines

To do what though? Add a new coredump format specifier that gives you a string-escaped version as one argument? That'd probably make sense,

Or, perhaps, we can simply change cn_escape() to do s/space/something/ unconditionally (currently it only does s'/'!'). But this is a user- visible change.

Oleg.

#4 lore raw
Quoted 12 lines · Oleg Nesterov
Quoted 11 lines · Colin Walters
Quoted 9 lines · Zbigniew Jędrzejewski-Szmek
Quoted 8 lines · Colin Walters

This patch makes systemd-coredump handle processes that have whitespace in their COMM fields.

fs/coredump.c when given %e (as systemd-coredump uses), will end up joining the process arguments into a string (along with the other fields), then will split the entire thing up on whitespace, and use it as the arguments to the coredump pipe handler.
---

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

That's a workaround for a bug in the kernel. I think it makes sense, but it'd be nice to fix the kernel too.

I wouldn't say this is bug... at least this is expected.

Sure, it is possible to rewrite format_corename/argv_split interaction, but this is a bit painful and I am not sure it worth the trouble.

It sounds really wrong to first merge this into one string and then split it up again. It sounds much more sensible to instead just pass the string array around all the time. What's the reason to make this one string first?

Lennart

Signature · 1 line
Lennart Poettering - Red Hat, Inc.
#5 lore raw
Quoted 4 lines · Lennart Poettering

It sounds really wrong to first merge this into one string and then split it up again. It sounds much more sensible to instead just pass the string array around all the time. What's the reason to make this one string first?

I'm wondering if there are compatibility concerns; abrt wouldn't care from what I can tell if we just changed the kernel. systemd-coredump is just plain broken right now. I'll look for the source to the Ubuntu one...

#6 lore raw
In reply to Lennart Poettering

Sorry for delay, vacation.

Quoted 5 lines · Lennart Poettering
Quoted 2 lines · Oleg Nesterov

I wouldn't say this is bug... at least this is expected.

Quoted 7 lines
Quoted 2 lines

Sure, it is possible to rewrite format_corename/argv_split interaction, but this is a bit painful and I am not sure it worth the trouble.

It sounds really wrong to first merge this into one string and then split it up again. It sounds much more sensible to instead just pass the string array around all the time. What's the reason to make this one string first?

!ispipe case.

OK. I have to admit that this doesn't look nice even if this is "historical" behaviour. The fix should be simple I guess, format_corename() should construct argv by hand, argv_split() should be avoided.

But:

- We do not want to complicate this (ugly) code more than necessary. In particular we shouldn't forget about ispipe.

Oh, and realloc, we can't count argc in advance or we need more changes to protect against proc_dostring_coredump().

- We should cleanup format_corename() first. If nothing else, cn_escape().

- Hmm. it seems that we also need to fix it, format_corename() can leak ->corename afaics.

In short: I'll try to do this when I have time.

Oleg.