RESOLVED FIXED 142982
[Seccomp Filters] Add helpers to get XDG base directory locations
https://bugs.webkit.org/show_bug.cgi?id=142982
Summary [Seccomp Filters] Add helpers to get XDG base directory locations
Michael Catanzaro
Reported 2015-03-23 14:02:59 PDT
To implement a semi-robust syscall policy, we need to know the actual XDG base directories, instead of hardcoding them. This will help with that.
Attachments
[Linux] Seccomp Filters: Add helper functions for common directories (6.50 KB, patch)
2015-03-23 14:11 PDT, Michael Catanzaro
no flags
[Linux] Seccomp Filters: Add helper functions for common directories (6.50 KB, patch)
2015-07-13 08:42 PDT, Michael Catanzaro
no flags
Patch (6.49 KB, patch)
2015-07-22 08:14 PDT, Michael Catanzaro
no flags
Patch (6.49 KB, patch)
2015-07-22 08:18 PDT, Michael Catanzaro
no flags
Michael Catanzaro
Comment 1 2015-03-23 14:11:00 PDT
Created attachment 249268 [details] [Linux] Seccomp Filters: Add helper functions for common directories
Michael Catanzaro
Comment 2 2015-07-13 08:42:00 PDT
Created attachment 256704 [details] [Linux] Seccomp Filters: Add helper functions for common directories
Michael Catanzaro
Comment 3 2015-07-20 13:13:35 PDT
Comment on attachment 256704 [details] [Linux] Seccomp Filters: Add helper functions for common directories This one's next, but I'm pretty sure I should find a better home for these files than WebKit2/Shared/linux/SeccompFilters. Maybe WebCore/platform/FileSystemGLib.cpp?
Michael Catanzaro
Comment 4 2015-07-20 13:14:54 PDT
The point of these functions, btw, is to use the GLib base directory functions without actually making SyscallPolicy.cpp depend on GLib.
Michael Catanzaro
Comment 5 2015-07-20 13:16:25 PDT
(In reply to comment #4) > The point of these functions, btw, is to use the GLib base directory > functions without actually making SyscallPolicy.cpp depend on GLib. Which maybe is not a worthwhile venture, since GTK, EFL, and WPE all use GLib.
Zan Dobersek
Comment 6 2015-07-22 06:05:19 PDT
I think it's okay to abstract away the GLib functions, but I'm not sure where to put the files. One option could be Source/WebCore/platform/seccompfilters, or a similarly named directory. The addition is specific to this feature, and the GLib-specific implementation could go into a UserDirectoriesGLib.cpp or similar, along with the UserDirectories.h header. ('BaseDirectory' sound odd to me.) FileSystem.h is a more generic API used throughout the code, but the additions would for the moment only be used in seccomp filters and nowhere else, so half of the ports would end up with unused stub implementations, or the additions would be #if-guarded away (which I dislike). Dunno.
Michael Catanzaro
Comment 7 2015-07-22 06:55:12 PDT
(In reply to comment #6) > I think it's okay to abstract away the GLib functions, but I'm not sure > where to put the files. > > One option could be Source/WebCore/platform/seccompfilters, or a similarly > named directory. I'd rather keep all the seccompfilters stuff in the WebKit2 layer. So that suggests we should keep it exactly where I added it in this patch, except perhaps renaming the file: > The addition is specific to this feature, and the > GLib-specific implementation could go into a UserDirectoriesGLib.cpp or > similar, along with the UserDirectories.h header. ('BaseDirectory' sound odd > to me.) UserDirectories is fine by me. I picked BaseDirectory because the functions are wrappers for the XDG Base Directory Specification [1], but I don't care what we call the file. [1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Zan Dobersek
Comment 8 2015-07-22 07:15:18 PDT
XDGBaseDirectory.h could fit then as well. Wasn't aware of the spec.
Zan Dobersek
Comment 9 2015-07-22 07:18:15 PDT
Comment on attachment 256704 [details] [Linux] Seccomp Filters: Add helper functions for common directories View in context: https://bugs.webkit.org/attachment.cgi?id=256704&action=review The remaining thing I'd recommend is to rename the implementation file into BaseDirectoryGLib.cpp (or whatever name we end up choosing), since the implementation depends on and is specific to GLib-using ports. > Source/WebKit2/Shared/linux/SeccompFilters/BaseDirectory.cpp:32 > +#include <glib.h> > + > +#if ENABLE(SECCOMP_FILTERS) glib.h should be included after the ENABLE() guard.
Michael Catanzaro
Comment 10 2015-07-22 08:14:13 PDT
Michael Catanzaro
Comment 11 2015-07-22 08:18:29 PDT
Michael Catanzaro
Comment 12 2015-07-22 08:19:14 PDT
(In reply to comment #9) > The remaining thing I'd recommend is to rename the implementation file into > BaseDirectoryGLib.cpp (or whatever name we end up choosing), since the > implementation depends on and is specific to GLib-using ports. OK, done. I went with XDGBaseDirectoryGLib.cpp. > glib.h should be included after the ENABLE() guard. Fixed.
Michael Catanzaro
Comment 13 2015-07-22 08:58:13 PDT
Note You need to log in before you can comment on or make changes to this bug.