WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
182086
DirectArguments should protect itself using dynamic poisoning and precise index masking
https://bugs.webkit.org/show_bug.cgi?id=182086
Summary
DirectArguments should protect itself using dynamic poisoning and precise ind...
Filip Pizlo
Reported
2018-01-24 23:48:09 PST
Patch forthcoming.
Attachments
maybe the patch
(18.49 KB, patch)
2018-01-24 23:54 PST
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
the patch
(20.66 KB, patch)
2018-01-25 14:44 PST
,
Filip Pizlo
saam
: review+
Details
Formatted Diff
Diff
patch for landing
(20.19 KB, patch)
2018-01-25 15:46 PST
,
Filip Pizlo
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Filip Pizlo
Comment 1
2018-01-24 23:54:32 PST
Created
attachment 332233
[details]
maybe the patch
Filip Pizlo
Comment 2
2018-01-25 14:44:32 PST
Created
attachment 332319
[details]
the patch
Saam Barati
Comment 3
2018-01-25 15:25:10 PST
Comment on
attachment 332319
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=332319&action=review
r=me w/ some naming nits and other tidbits
> Source/JavaScriptCore/runtime/DirectArguments.h:122 > + return *preciseIndexMaskPtr(offset.offset(), std::max(m_length, m_minCapacity), dynamicPoison(type(), DirectArgumentsType, ptr));
could this max() be spectre trained in a way that hurts us?
> Source/WTF/wtf/MathExtras.h:492 > +inline unsigned preciseIndexMaskShiftForSize(unsigned size) > +{ > + return size * 8 - 1; > +} > + > +template<typename T> > +unsigned preciseIndexMaskShift() > +{ > + return preciseIndexMaskShiftForSize(sizeof(T)); > +}
constexpr for both of these?
> Source/WTF/wtf/MathExtras.h:497 > + asm("" : "+r"(pointer));
asm volatile?
> Source/WTF/wtf/MathExtras.h:516 > + (static_cast<uintptr_t>(opaque(actual) ^ expected) << 40));
Is it worth giving this 40 a name since it's hard coded inside JSC in a few places too?
Filip Pizlo
Comment 4
2018-01-25 15:35:02 PST
(In reply to Saam Barati from
comment #3
)
> Comment on
attachment 332319
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=332319&action=review
> > r=me w/ some naming nits and other tidbits > > > Source/JavaScriptCore/runtime/DirectArguments.h:122 > > + return *preciseIndexMaskPtr(offset.offset(), std::max(m_length, m_minCapacity), dynamicPoison(type(), DirectArgumentsType, ptr)); > > could this max() be spectre trained in a way that hurts us?
No. At worst, you'll get a smaller limit.
> > > Source/WTF/wtf/MathExtras.h:492 > > +inline unsigned preciseIndexMaskShiftForSize(unsigned size) > > +{ > > + return size * 8 - 1; > > +} > > + > > +template<typename T> > > +unsigned preciseIndexMaskShift() > > +{ > > + return preciseIndexMaskShiftForSize(sizeof(T)); > > +} > > constexpr for both of these?
I'll try that.
> > > Source/WTF/wtf/MathExtras.h:497 > > + asm("" : "+r"(pointer)); > > asm volatile?
I don't need it to be volatile.
> > > Source/WTF/wtf/MathExtras.h:516 > > + (static_cast<uintptr_t>(opaque(actual) ^ expected) << 40)); > > Is it worth giving this 40 a name since it's hard coded inside JSC in a few > places too?
I'll do that.
Filip Pizlo
Comment 5
2018-01-25 15:46:15 PST
Created
attachment 332327
[details]
patch for landing
Radar WebKit Bug Importer
Comment 6
2018-01-25 16:08:23 PST
<
rdar://problem/36887421
>
Filip Pizlo
Comment 7
2018-01-25 16:08:32 PST
Landed in
https://trac.webkit.org/changeset/227643/webkit
Mark Lam
Comment 8
2018-01-25 16:30:44 PST
Comment on
attachment 332327
[details]
patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=332327&action=review
> Source/JavaScriptCore/jit/AssemblyHelpers.cpp:1049 > + UNUSED_PARAM(actualValue);
This is a typo, and as a result, you're breaking the 32-bit builds.
Mark Lam
Comment 9
2018-01-25 16:42:39 PST
Comment on
attachment 332327
[details]
patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=332327&action=review
>> Source/JavaScriptCore/jit/AssemblyHelpers.cpp:1049 >> + UNUSED_PARAM(actualValue); > > This is a typo, and as a result, you're breaking the 32-bit builds.
Fixed 32-bit build in
r227644
: <
https://trac.webkit.org/r227644
>.
Matt Lewis
Comment 10
2018-01-25 17:31:56 PST
This also broke the windows build. Looks like its a syntax error and another error: MathExtras.h(497): error C2059: syntax error: ':'
https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/7382
Filip Pizlo
Comment 11
2018-01-25 17:37:48 PST
(In reply to Matt Lewis from
comment #10
)
> This also broke the windows build. > > Looks like its a syntax error and another error: > > MathExtras.h(497): error C2059: syntax error: ':' > >
https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/
> 7382
Fixed in
https://trac.webkit.org/changeset/227648/webkit
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug