Title: [265299] trunk/Source/_javascript_Core
Revision
265299
Author
keith_mil...@apple.com
Date
2020-08-05 12:40:16 -0700 (Wed, 05 Aug 2020)

Log Message

The various AllowList options should be able to take the function name inline
https://bugs.webkit.org/show_bug.cgi?id=215184

Reviewed by Saam Barati.

Right now when I use the various AllowList JSC options I almost
always only care about a single function. Right now you need to
create a file with that single name in it. That is inconvenient, so
this patch changes the behavior to treat the string as the
function name if no file at that path exists. I'm also
speculatively assuming fopen doesn't return ENOENT when it fails
due to sandboxing... I didn't feel like testing it because this is
a debug option.

* runtime/OptionsList.h:
* tools/FunctionAllowlist.cpp:
(JSC::FunctionAllowlist::FunctionAllowlist):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (265298 => 265299)


--- trunk/Source/_javascript_Core/ChangeLog	2020-08-05 19:23:06 UTC (rev 265298)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-08-05 19:40:16 UTC (rev 265299)
@@ -1,5 +1,25 @@
 2020-08-05  Keith Miller  <keith_mil...@apple.com>
 
+        The various AllowList options should be able to take the function name inline
+        https://bugs.webkit.org/show_bug.cgi?id=215184
+
+        Reviewed by Saam Barati.
+
+        Right now when I use the various AllowList JSC options I almost
+        always only care about a single function. Right now you need to
+        create a file with that single name in it. That is inconvenient, so
+        this patch changes the behavior to treat the string as the
+        function name if no file at that path exists. I'm also
+        speculatively assuming fopen doesn't return ENOENT when it fails
+        due to sandboxing... I didn't feel like testing it because this is
+        a debug option.
+
+        * runtime/OptionsList.h:
+        * tools/FunctionAllowlist.cpp:
+        (JSC::FunctionAllowlist::FunctionAllowlist):
+
+2020-08-05  Keith Miller  <keith_mil...@apple.com>
+
         Add assertions / inline capacity to checkpoint side state stacks
         https://bugs.webkit.org/show_bug.cgi?id=215175
 

Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (265298 => 265299)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-08-05 19:23:06 UTC (rev 265298)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2020-08-05 19:40:16 UTC (rev 265299)
@@ -135,9 +135,9 @@
     v(OptionRange, bytecodeRangeToJITCompile, 0, Normal, "bytecode size range to allow compilation on, e.g. 1:100") \
     v(OptionRange, bytecodeRangeToDFGCompile, 0, Normal, "bytecode size range to allow DFG compilation on, e.g. 1:100") \
     v(OptionRange, bytecodeRangeToFTLCompile, 0, Normal, "bytecode size range to allow FTL compilation on, e.g. 1:100") \
-    v(OptionString, jitAllowlist, nullptr, Normal, "file with newline separated list of function signatures to allow compilation on") \
-    v(OptionString, dfgAllowlist, nullptr, Normal, "file with newline separated list of function signatures to allow DFG compilation on") \
-    v(OptionString, ftlAllowlist, nullptr, Normal, "file with newline separated list of function signatures to allow FTL compilation on") \
+    v(OptionString, jitAllowlist, nullptr, Normal, "file with newline separated list of function signatures to allow compilation on or, if no such file exists, the function signature to allow") \
+    v(OptionString, dfgAllowlist, nullptr, Normal, "file with newline separated list of function signatures to allow DFG compilation on or, if no such file exists, the function signature to allow") \
+    v(OptionString, ftlAllowlist, nullptr, Normal, "file with newline separated list of function signatures to allow FTL compilation on or, if no such file exists, the function signature to allow") \
     v(Bool, dumpSourceAtDFGTime, false, Normal, "dumps source code of JS function being DFG compiled") \
     v(Bool, dumpBytecodeAtDFGTime, false, Normal, "dumps bytecode of JS function being DFG compiled") \
     v(Bool, dumpGraphAfterParsing, false, Normal, nullptr) \

Modified: trunk/Source/_javascript_Core/tools/FunctionAllowlist.cpp (265298 => 265299)


--- trunk/Source/_javascript_Core/tools/FunctionAllowlist.cpp	2020-08-05 19:23:06 UTC (rev 265298)
+++ trunk/Source/_javascript_Core/tools/FunctionAllowlist.cpp	2020-08-05 19:40:16 UTC (rev 265299)
@@ -41,7 +41,11 @@
 
     FILE* f = fopen(filename, "r");
     if (!f) {
-        dataLogF("Failed to open file %s. Did you add the file-read-data entitlement to WebProcess.sb?\n", filename); 
+        if (errno == ENOENT) {
+            m_hasActiveAllowlist = true;
+            m_entries.add(filename);
+        } else
+            dataLogF("Failed to open file %s. Did you add the file-read-data entitlement to WebProcess.sb? Error code: %s\n", filename, strerror(errno));
         return;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to