Closed
Bug 1430745
Opened 6 years ago
Closed 6 years ago
IPC: Fix unaligned accesses in DirReaderLinux
Categories
(Core :: IPC, enhancement)
Core
IPC
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: hev, Assigned: hev)
Details
Attachments
(1 file, 1 obsolete file)
703 bytes,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•6 years ago
|
||
Attachment #8942879 -
Flags: review?(continuation)
Updated•6 years ago
|
Attachment #8942879 -
Flags: review?(continuation) → review?(nfroyd)
Comment 2•6 years ago
|
||
Comment on attachment 8942879 [details] [diff] [review] 0001-Bug-1430745-IPC-Fix-unaligned-accesses-in-DirReaderL.patch Review of attachment 8942879 [details] [diff] [review]: ----------------------------------------------------------------- I can't review this without *some* explanation of what's going wrong here. 16-byte alignment seems very aggressive.
Attachment #8942879 -
Flags: review?(nfroyd)
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #2) > Comment on attachment 8942879 [details] [diff] [review] > 0001-Bug-1430745-IPC-Fix-unaligned-accesses-in-DirReaderL.patch > > Review of attachment 8942879 [details] [diff] [review]: > ----------------------------------------------------------------- > > I can't review this without *some* explanation of what's going wrong here. > 16-byte alignment seems very aggressive. I found the address of 'buf_' doesn't meet the 8-byte alignment requirements when it reinterpret cast to linux_dirent. On some RISC platforms, such as MIPS/ARM, it affect performance because a unaligned exception raised and need do simulate in kernel. I think grow up to 16-byte may be is friendly to optimizied memcpy (128-bit SSE implementation).
Flags: needinfo?(r)
Assignee | ||
Updated•6 years ago
|
Attachment #8942879 -
Flags: review?(nfroyd)
Comment 5•6 years ago
|
||
OK, thanks for explaining the problem. I guess the 8-byte alignment requirement comes from the *int64_t members of linux_dirent, then? I think we can fix this in one of two ways: 1) Use a union { linux_dirent d; char buf[512]; } and rewrite the code to reference appropriate members of the union. 2) Use __attribute__((aligned(8))). It's not worth over-aligning this buffer; the code here is not performance-sensitive.
Comment 6•6 years ago
|
||
Comment on attachment 8942879 [details] [diff] [review] 0001-Bug-1430745-IPC-Fix-unaligned-accesses-in-DirReaderL.patch 16-byte alignment is too aggressive. See previous comment.
Attachment #8942879 -
Flags: review?(nfroyd)
Assignee | ||
Comment 7•6 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #5) > OK, thanks for explaining the problem. I guess the 8-byte alignment > requirement comes from the *int64_t members of linux_dirent, then? > > I think we can fix this in one of two ways: > > 1) Use a union { linux_dirent d; char buf[512]; } and rewrite the code to > reference appropriate members of the union. Good idea! This way is more versatile, even if linux_dirent changes in the future. Thank you! > 2) Use __attribute__((aligned(8))). > > It's not worth over-aligning this buffer; the code here is not > performance-sensitive.
Assignee | ||
Comment 8•6 years ago
|
||
Attachment #8942879 -
Attachment is obsolete: true
Attachment #8943092 -
Flags: review?(nfroyd)
Comment 9•6 years ago
|
||
Comment on attachment 8943092 [details] [diff] [review] 0001-Bug-1430745-IPC-Fix-unaligned-accesses-in-DirReaderL.patch Review of attachment 8943092 [details] [diff] [review]: ----------------------------------------------------------------- Thank you! r=me with the change below. ::: ipc/chromium/src/base/dir_reader_linux.h @@ +90,5 @@ > > private: > const int fd_; > + union { > + linux_dirent dirent; Nit: I would call this `dirent_` to align with the local style.
Attachment #8943092 -
Flags: review?(nfroyd) → review+
Comment 10•6 years ago
|
||
Pushed by r@hev.cc: https://hg.mozilla.org/integration/mozilla-inbound/rev/f9019fd30399 IPC: Fix unaligned accesses in DirReaderLinux. r=froydnj
Comment 11•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f9019fd30399
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in
before you can comment on or make changes to this bug.
Description
•