diff options
| author | Richard Guy Briggs <rgb@redhat.com> | 2014-12-23 13:02:04 -0500 |
|---|---|---|
| committer | Paul Moore <pmoore@redhat.com> | 2014-12-23 16:40:18 -0500 |
| commit | 041d7b98ffe59c59fdd639931dea7d74f9aa9a59 (patch) | |
| tree | 1655d8bc82a0fcbf4f1d4e118aa1b6daeed6f9e0 /kernel | |
| parent | 4a92843601ad0f5067f441d2f0dca55bbe18c076 (diff) | |
audit: restore AUDIT_LOGINUID unset ABI
A regression was caused by commit 780a7654cee8:
audit: Make testing for a valid loginuid explicit.
(which in turn attempted to fix a regression caused by e1760bd)
When audit_krule_to_data() fills in the rules to get a listing, there was a
missing clause to convert back from AUDIT_LOGINUID_SET to AUDIT_LOGINUID.
This broke userspace by not returning the same information that was sent and
expected.
The rule:
auditctl -a exit,never -F auid=-1
gives:
auditctl -l
LIST_RULES: exit,never f24=0 syscall=all
when it should give:
LIST_RULES: exit,never auid=-1 (0xffffffff) syscall=all
Tag it so that it is reported the same way it was set. Create a new
private flags audit_krule field (pflags) to store it that won't interact with
the public one from the API.
Cc: stable@vger.kernel.org # v3.10-rc1+
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/auditfilter.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index c0d148bd7a5c..103586e239a2 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
| @@ -442,6 +442,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data, | |||
| 442 | if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) { | 442 | if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) { |
| 443 | f->type = AUDIT_LOGINUID_SET; | 443 | f->type = AUDIT_LOGINUID_SET; |
| 444 | f->val = 0; | 444 | f->val = 0; |
| 445 | entry->rule.pflags |= AUDIT_LOGINUID_LEGACY; | ||
| 445 | } | 446 | } |
| 446 | 447 | ||
| 447 | err = audit_field_valid(entry, f); | 448 | err = audit_field_valid(entry, f); |
| @@ -617,6 +618,13 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule) | |||
| 617 | data->buflen += data->values[i] = | 618 | data->buflen += data->values[i] = |
| 618 | audit_pack_string(&bufp, krule->filterkey); | 619 | audit_pack_string(&bufp, krule->filterkey); |
| 619 | break; | 620 | break; |
| 621 | case AUDIT_LOGINUID_SET: | ||
| 622 | if (krule->pflags & AUDIT_LOGINUID_LEGACY && !f->val) { | ||
| 623 | data->fields[i] = AUDIT_LOGINUID; | ||
| 624 | data->values[i] = AUDIT_UID_UNSET; | ||
| 625 | break; | ||
| 626 | } | ||
| 627 | /* fallthrough if set */ | ||
| 620 | default: | 628 | default: |
| 621 | data->values[i] = f->val; | 629 | data->values[i] = f->val; |
| 622 | } | 630 | } |
| @@ -633,6 +641,7 @@ static int audit_compare_rule(struct audit_krule *a, struct audit_krule *b) | |||
| 633 | int i; | 641 | int i; |
| 634 | 642 | ||
| 635 | if (a->flags != b->flags || | 643 | if (a->flags != b->flags || |
| 644 | a->pflags != b->pflags || | ||
| 636 | a->listnr != b->listnr || | 645 | a->listnr != b->listnr || |
| 637 | a->action != b->action || | 646 | a->action != b->action || |
| 638 | a->field_count != b->field_count) | 647 | a->field_count != b->field_count) |
| @@ -751,6 +760,7 @@ struct audit_entry *audit_dupe_rule(struct audit_krule *old) | |||
| 751 | new = &entry->rule; | 760 | new = &entry->rule; |
| 752 | new->vers_ops = old->vers_ops; | 761 | new->vers_ops = old->vers_ops; |
| 753 | new->flags = old->flags; | 762 | new->flags = old->flags; |
| 763 | new->pflags = old->pflags; | ||
| 754 | new->listnr = old->listnr; | 764 | new->listnr = old->listnr; |
| 755 | new->action = old->action; | 765 | new->action = old->action; |
| 756 | for (i = 0; i < AUDIT_BITMASK_SIZE; i++) | 766 | for (i = 0; i < AUDIT_BITMASK_SIZE; i++) |
