hfsplus: fixes worst-case unicode to char conversion of file names and attributes
------------------------------
Quoted 19 lines · BST Vyacheslav Dubeyko
Quoted 4 lines · Anton Altaparmakov
Hi Hin-Tak,
That now looks good.
Quoted 11 lines
I agree with you that doing a major cleanup of how attribute names are handled is a separate patch. As you say that is much more work and it is not as trivial as this. I think doing the attribute handling properly requires reworking how it all fits together because it is imposing the name length checks at the wrong level - they need to be done after conversion to UTF-16 not whilst they are still in the current NLS (except of course you want to check that they are not too big to fit in the buffer though it is not at all clear to me why the argument is being copied into a buffer in the first place at least in one of the places I looked at - seems a waste of CPU time to me).
Yes, it is possible to split the work on several patches. I agree with it.
Quoted 9 lines
But I suppose that these patches needs to be joined in one patchset. Because reported issue can be solved by fix as for file names as for xattr names.
Of course, it is possible to fix the issue with file names, firstly, and then the issue with xattr names. But it doesn't make sense to mix fixes for file names and for xattr names in one patch. Because partial fix in
hfsplus_listxattr()doesn't fix the issue for xattr names.
Think of it as "fixes worst-case usage of hfsplus_uni2asc()", then it makes sense to have this as one patch. Allowing full usage of getting and setting of long multi-lingual attributes, and checking other uses of HFSPLUS_ATTR_MAX_STRLEN really need to be another (multiple others).
There are only two usages of hfsplus_uni2asc(), one for names and one for attributes.
Quoted 8 lines
Quoted 7 lines
Also, I don't think it is needed to set up a kmem cache for this - kmalloc is perfect - as at any one time there will be a vanishingly small number of these buffers allocated at any one time. After all, how many concurrent
readdir()calls are there going to be on a volume at any one time? It is not like the struct inode or other long lived memory structures where you end up with thousands of them in memory at any one time...
Quoted 4 lines
Yes, kmalloc can be enough for
readdir()case. But I suppose that it needs to use kmem cache for the case of xattr names. It will be more efficient solution.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Apr 8, 2014, at 8:43 PM, Hin-Tak Leung wrote:
[snip]
Quoted 13 lines
Quoted 12 lines
Yes, it is possible to split the work on several patches. I agree with it.
But I suppose that these patches needs to be joined in one patchset. Because reported issue can be solved by fix as for file names as for xattr names.
Of course, it is possible to fix the issue with file names, firstly, and then the issue with xattr names. But it doesn't make sense to mix fixes for file names and for xattr names in one patch. Because partial fix in
hfsplus_listxattr()doesn't fix the issue for xattr names.
Quoted 8 lines
Think of it as "fixes worst-case usage of
hfsplus_uni2asc()", then it makes sense to have this as one patch. Allowing full usage of getting and setting of long multi-lingual attributes, and checking other uses ofHFSPLUS_ATTR_MAX_STRLENreally need to be another (multiple others).There are only two usages of
hfsplus_uni2asc(), one for names and one for attributes.
Unfortunately, it doesn't make sense to have fix only in hfsplus_listxattr(). It fixes nothing for xattr names. Of course, you can mention name of the patch. :) But such partial fix doesn't make sense for me. It will be more clear way to have one patch for file names and another patch for xattr names.
Thanks,
Vyacheslav Dubeyko.
Hi,
Quoted 21 lines · Vyacheslav Dubeyko
On Apr 8, 2014, at 8:43 PM, Hin-Tak Leung wrote:
[snip]Quoted 19 lines
Quoted 12 lines
Yes, it is possible to split the work on several patches. I agree with it.
But I suppose that these patches needs to be joined in one patchset. Because reported issue can be solved by fix as for file names as for xattr names.
Of course, it is possible to fix the issue with file names, firstly, and then the issue with xattr names. But it doesn't make sense to mix fixes for file names and for xattr names in one patch. Because partial fix in
hfsplus_listxattr()doesn't fix the issue for xattr names.Think of it as "fixes worst-case usage of
hfsplus_uni2asc()", then it makes sense to have this as one patch. Allowing full usage of getting and setting of long multi-lingual attributes, and checking other uses ofHFSPLUS_ATTR_MAX_STRLENreally need to be another (multiple others).
Quoted 7 lines
Quoted 2 lines
There are only two usages of
hfsplus_uni2asc(), one for names and one for attributes.Unfortunately, it doesn't make sense to have fix only in
hfsplus_listxattr(). It fixes nothing for xattr names. Of course, you can mention name of the patch. :) But such partial fix doesn't make sense for me. It will be more clear way to have one patch for file names and another patch for xattr names.
You are entitled to your opinion but I agree with Hin-Tak. This makes perfect sense as it fixes the use of a function which can otherwise cause an erroneous EIO error to be returned from listxattr(). This in itself is a worthwhile fix. Your idea of having to fix everything or nothing at all is frankly quite silly and would mean that hardly anything ever gets fixed... Fixing small problems individually is just fine, especially when they are such obvious ones.
Best regards,
Anton
Quoted 2 lines
Thanks,
Vyacheslav Dubeyko.
Signature · 3 lines
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Unix Support, Computing Service, University of Cambridge J.J. Thomson Avenue, Cambridge, CB3 0RB, UK
On Apr 8, 2014, at 9:09 PM, Anton Altaparmakov wrote:
[snip]
Quoted 8 lines
Quoted 5 lines
Unfortunately, it doesn't make sense to have fix only in
hfsplus_listxattr(). It fixes nothing for xattr names. Of course, you can mention name of the patch. :) But such partial fix doesn't make sense for me. It will be more clear way to have one patch for file names and another patch for xattr names.You are entitled to your opinion but I agree with Hin-Tak. This makes perfect sense as it fixes the use of a function which can otherwise cause an erroneous EIO error to be returned from
listxattr(). This in itself is a worthwhile fix. Your idea of having to fix everything or nothing at all is frankly quite silly and would mean that hardly anything ever gets fixed... Fixing small problems individually is just fine, especially when they are such obvious ones.
I have another opinion. :) But, of course, it is possible to see on things in different ways. I don't think that topic of splitting fixes between patches is really important. But my suggestion has more logical basis.
But, anyway, I suggest to use kmem cache for the case of xattr names instead of kmalloc.
Thanks,
Vyacheslav Dubeyko.