* [PATCH] xfs_repair: properly detect reserved attribute names
@ 2015-05-14 3:29 Eric Sandeen
2015-05-14 14:22 ` Brian Foster
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2015-05-14 3:29 UTC (permalink / raw)
To: xfs-oss; +Cc: Zach Brown
This function in xfs_repair tries to make sure that if an attr
name reserved for acls exists in the root namespace, then its
value is a valid acl.
However, because it only compares up to the length of the
reserved name, superstrings may match and cause false positive
xfs_repair errors.
Ensure that both the length and the content match before
flagging it as an error.
Spotted-by: Zach Brown <zab@zabbo.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/repair/attr_repair.c b/repair/attr_repair.c
index 27442c4..89a5bbf 100644
--- a/repair/attr_repair.c
+++ b/repair/attr_repair.c
@@ -747,9 +747,10 @@ valuecheck(
void *valuep;
int clearit = 0;
- if ((strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
- (strncmp(namevalue, SGI_ACL_DEFAULT,
- SGI_ACL_DEFAULT_SIZE) == 0)) {
+ if ((namelen == SGI_ACL_FILE_SIZE &&
+ strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
+ (namelen == SGI_ACL_DEFAULT_SIZE &&
+ strncmp(namevalue, SGI_ACL_DEFAULT, SGI_ACL_DEFAULT_SIZE) == 0)) {
if (value == NULL) {
valuep = malloc(valuelen);
if (!valuep)
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs_repair: properly detect reserved attribute names
2015-05-14 3:29 [PATCH] xfs_repair: properly detect reserved attribute names Eric Sandeen
@ 2015-05-14 14:22 ` Brian Foster
2015-05-14 15:05 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Brian Foster @ 2015-05-14 14:22 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Zach Brown, xfs-oss
On Wed, May 13, 2015 at 10:29:42PM -0500, Eric Sandeen wrote:
> This function in xfs_repair tries to make sure that if an attr
> name reserved for acls exists in the root namespace, then its
> value is a valid acl.
>
> However, because it only compares up to the length of the
> reserved name, superstrings may match and cause false positive
> xfs_repair errors.
>
> Ensure that both the length and the content match before
> flagging it as an error.
>
> Spotted-by: Zach Brown <zab@zabbo.net>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
Looks good:
Reviewed-by: Brian Foster <bfoster@redhat.com>
So it looks like master doesn't have the sizeof(unsigned char *)
problem and the 4.1 update branch does, so we want to make sure that
kernel fix makes it into the latter...
>
> diff --git a/repair/attr_repair.c b/repair/attr_repair.c
> index 27442c4..89a5bbf 100644
> --- a/repair/attr_repair.c
> +++ b/repair/attr_repair.c
> @@ -747,9 +747,10 @@ valuecheck(
> void *valuep;
> int clearit = 0;
>
> - if ((strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
> - (strncmp(namevalue, SGI_ACL_DEFAULT,
> - SGI_ACL_DEFAULT_SIZE) == 0)) {
> + if ((namelen == SGI_ACL_FILE_SIZE &&
> + strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
> + (namelen == SGI_ACL_DEFAULT_SIZE &&
> + strncmp(namevalue, SGI_ACL_DEFAULT, SGI_ACL_DEFAULT_SIZE) == 0)) {
> if (value == NULL) {
> valuep = malloc(valuelen);
> if (!valuep)
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs_repair: properly detect reserved attribute names
2015-05-14 14:22 ` Brian Foster
@ 2015-05-14 15:05 ` Eric Sandeen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2015-05-14 15:05 UTC (permalink / raw)
To: Brian Foster; +Cc: Zach Brown, xfs-oss
On 5/14/15 9:22 AM, Brian Foster wrote:
> On Wed, May 13, 2015 at 10:29:42PM -0500, Eric Sandeen wrote:
>> This function in xfs_repair tries to make sure that if an attr
>> name reserved for acls exists in the root namespace, then its
>> value is a valid acl.
>>
>> However, because it only compares up to the length of the
>> reserved name, superstrings may match and cause false positive
>> xfs_repair errors.
>>
>> Ensure that both the length and the content match before
>> flagging it as an error.
>>
>> Spotted-by: Zach Brown <zab@zabbo.net>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>
> Looks good:
>
> Reviewed-by: Brian Foster <bfoster@redhat.com>
>
> So it looks like master doesn't have the sizeof(unsigned char *)
> problem and the 4.1 update branch does, so we want to make sure that
> kernel fix makes it into the latter...
Yep. This fix is needed independently of that, though.
Thanks!
-Eric
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-14 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 3:29 [PATCH] xfs_repair: properly detect reserved attribute names Eric Sandeen
2015-05-14 14:22 ` Brian Foster
2015-05-14 15:05 ` Eric Sandeen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.