From: Nicolas Belouin <hidden> Date: 2017-10-21 13:30:34
In its current implementation the check is against CAP_SYS_ADMIN,
however this capability is bloated and inapropriate for this use.
Indeed the check aims to avoid dedupe against non writable files,
falling directly in the use case of CAP_DAC_OVERRIDE.
Signed-off-by: Nicolas Belouin <redacted>
---
fs/read_write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Nick Kralevich <hidden> Date: 2017-10-21 14:08:31
On Sat, Oct 21, 2017 at 6:28 AM, Nicolas Belouin [off-list ref] wrote:
quoted hunk
In its current implementation the check is against CAP_SYS_ADMIN,
however this capability is bloated and inapropriate for this use.
Indeed the check aims to avoid dedupe against non writable files,
falling directly in the use case of CAP_DAC_OVERRIDE.
Signed-off-by: Nicolas Belouin <redacted>
---
fs/read_write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Can you please reverse the order of the checks? In particular, on an
SELinux based system, a capable() call generates an SELinux denial,
and people often instinctively allow the first operation performed.
Reordering the elements will ensure that the CAP_DAC_OVERRIDE denial
(least permissive) is generated first.
From: Nicolas Belouin <hidden> Date: 2017-10-21 19:40:30
On October 21, 2017 4:08:31 PM GMT+02:00, Nick Kralevich [off-list ref] wrote:
On Sat, Oct 21, 2017 at 6:28 AM, Nicolas Belouin [off-list ref]
wrote:
quoted
In its current implementation the check is against CAP_SYS_ADMIN,
however this capability is bloated and inapropriate for this use.
Indeed the check aims to avoid dedupe against non writable files,
falling directly in the use case of CAP_DAC_OVERRIDE.
Signed-off-by: Nicolas Belouin <redacted>
---
fs/read_write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1965,7 +1965,7 @@ int vfs_dedupe_file_range(struct file *file,
struct file_dedupe_range *same)
quoted
u64 len;
int i;
int ret;
- bool is_admin = capable(CAP_SYS_ADMIN);
+ bool is_admin = capable(CAP_SYS_ADMIN) ||
capable(CAP_DAC_OVERRIDE);
Can you please reverse the order of the checks? In particular, on an
SELinux based system, a capable() call generates an SELinux denial,
and people often instinctively allow the first operation performed.
Reordering the elements will ensure that the CAP_DAC_OVERRIDE denial
(least permissive) is generated first.
From: Andy Lutomirski <luto@kernel.org> Date: 2017-10-26 07:55:04
On Sat, Oct 21, 2017 at 12:40 PM, Nicolas Belouin [off-list ref] wrote:
On October 21, 2017 4:08:31 PM GMT+02:00, Nick Kralevich [off-list ref] wrote:
quoted
On Sat, Oct 21, 2017 at 6:28 AM, Nicolas Belouin [off-list ref]
wrote:
quoted
In its current implementation the check is against CAP_SYS_ADMIN,
however this capability is bloated and inapropriate for this use.
Indeed the check aims to avoid dedupe against non writable files,
falling directly in the use case of CAP_DAC_OVERRIDE.
Signed-off-by: Nicolas Belouin <redacted>
---
fs/read_write.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -1965,7 +1965,7 @@ int vfs_dedupe_file_range(struct file *file,
struct file_dedupe_range *same)
quoted
u64 len;
int i;
int ret;
- bool is_admin = capable(CAP_SYS_ADMIN);
+ bool is_admin = capable(CAP_SYS_ADMIN) ||
capable(CAP_DAC_OVERRIDE);
Can you please reverse the order of the checks? In particular, on an
SELinux based system, a capable() call generates an SELinux denial,
and people often instinctively allow the first operation performed.
Reordering the elements will ensure that the CAP_DAC_OVERRIDE denial
(least permissive) is generated first.
Will do in the v2 of every concerned patch.
That's still a bit wrong because of how audit works. What you really want is:
bool have_either_global_cap(int cap1, int cap2);
where, if neither cap is available, the audit message references cap1
and not cap2. Ditto for have_either_ns_cap().
--Andy