coredump filter: add mask for 'all' using UINT32_MAX, not UINT64_MAX
The kernel returns ERANGE when UINT64_MAX is passed. Create a mask and use UINT32_max, which is accepted, so that future bits will also be set.
This commit is contained in:
@@ -46,7 +46,7 @@ int coredump_filter_mask_from_string(const char *s, uint64_t *ret) {
|
||||
}
|
||||
|
||||
if (streq(n, "all")) {
|
||||
m = UINT64_MAX;
|
||||
m = COREDUMP_FILTER_MASK_ALL;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ typedef enum CoredumpFilter {
|
||||
1u << COREDUMP_FILTER_ELF_HEADERS | \
|
||||
1u << COREDUMP_FILTER_PRIVATE_HUGE)
|
||||
|
||||
/* The kernel doesn't like UINT64_MAX and returns ERANGE, use UINT32_MAX to support future new flags */
|
||||
#define COREDUMP_FILTER_MASK_ALL UINT32_MAX
|
||||
|
||||
const char* coredump_filter_to_string(CoredumpFilter i) _const_;
|
||||
CoredumpFilter coredump_filter_from_string(const char *s) _pure_;
|
||||
int coredump_filter_mask_from_string(const char *s, uint64_t *ret);
|
||||
|
||||
@@ -28,6 +28,8 @@ TEST(coredump_filter_mask_from_string) {
|
||||
uint64_t f;
|
||||
assert_se(coredump_filter_mask_from_string("default", &f) == 0);
|
||||
assert_se(f == COREDUMP_FILTER_MASK_DEFAULT);
|
||||
assert_se(coredump_filter_mask_from_string("all", &f) == 0);
|
||||
assert_se(f == COREDUMP_FILTER_MASK_ALL);
|
||||
|
||||
assert_se(coredump_filter_mask_from_string(" default\tdefault\tdefault ", &f) == 0);
|
||||
assert_se(f == COREDUMP_FILTER_MASK_DEFAULT);
|
||||
|
||||
Reference in New Issue
Block a user