Closed Bug 1650076 Opened 5 years ago Closed 5 years ago

Bad printf format strings/argument lists in IndexedDB logging

Categories

(Core :: Storage: IndexedDB, task)

task

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: sg, Assigned: sg)

Details

Attachments

(4 files)

Apparently, the format check at https://searchfox.org/mozilla-central/rev/31d8600b73dc85b4cdbabf45ac3f1a9c11700d8e/dom/indexedDB/ProfilerHelpers.h#248 has no effect because it is only called indirectly, not with literal format strings from https://searchfox.org/mozilla-central/rev/31d8600b73dc85b4cdbabf45ac3f1a9c11700d8e/dom/indexedDB/ProfilerHelpers.h#312

And actually several format strings/argument lists are not correct.

As part of fixing this, I will convert the macro IDB_LOG_MARK2 into a proper function.

Summary: Bad printf format strings in IndexedDB logging → Bad printf format strings/argument lists in IndexedDB logging

This also ensures that the checking of the printf format strings/argument lists
is effective.

Depends on D82016

Move ThreadLocal to a separate header file.
Reuse LoggingIdString in ThreadLocal (and make use of nsAutoCStringN).

Depends on D82017

Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/42df520d1cff Move ProfilerHelpers implementation into cpp file. r=dom-workers-and-storage-reviewers,asuth https://hg.mozilla.org/integration/autoland/rev/1d378f2af866 Fix bad printf format strings/argument lists. r=dom-workers-and-storage-reviewers,asuth https://hg.mozilla.org/integration/autoland/rev/18b34fb0ddbd Convert IDB_LOG_MARK2 into a proper function. r=dom-workers-and-storage-reviewers,asuth https://hg.mozilla.org/integration/autoland/rev/42951b61e9dc Clean up ThreadLocal. r=dom-workers-and-storage-reviewers,asuth

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&resultStatus=testfailed%2Cbusted%2Cexception&revision=42951b61e9dc2b5bee559edae57a423212eaf3e7&selectedTaskRun=Id51o1vnSBmUOj7lVgB_Cw.0

Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=308458875&repo=autoland

Backout link: https://hg.mozilla.org/integration/autoland/rev/d0ff8bcce2867b19ac0ffe8f4a2b3ff7eb91bef8

[task 2020-07-03T08:45:00.020Z] 08:45:00     INFO -  make[4]: Entering directory '/builds/worker/workspace/obj-build/dom/indexedDB'
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -  /builds/worker/fetches/sccache/sccache /builds/worker/fetches/gcc/bin/g++ -std=gnu++17 -o ActorsParent.o -c  -I/builds/worker/workspace/obj-build/dist/stl_wrappers -I/builds/worker/workspace/obj-build/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DDEBUG=1 -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/builds/worker/checkouts/gecko/dom/indexedDB -I/builds/worker/workspace/obj-build/dom/indexedDB -I/builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/ipc/glue -I/builds/worker/checkouts/gecko/dom/base -I/builds/worker/checkouts/gecko/dom/storage -I/builds/worker/checkouts/gecko/ipc/glue -I/builds/worker/checkouts/gecko/third_party/sqlite3/src -I/builds/worker/checkouts/gecko/xpcom/build -I/builds/worker/workspace/obj-build/dist/include -I/builds/worker/workspace/obj-build/dist/include/nspr -I/builds/worker/workspace/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-build/mozilla-config.h -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wduplicated-cond -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wformat -Wformat-overflow=2 -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -Os -fno-omit-frame-pointer -funwind-tables -Werror -Wno-error=shadow  -MD -MP -MF .deps/ActorsParent.o.pp   /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -  In file included from /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp:121:0:
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp: In member function 'virtual void mozilla::dom::indexedDB::{anonymous}::TransactionBase::CommitOp::TransactionFinishedAfterUnblock()':
[task 2020-07-03T08:45:00.021Z] 08:45:00    ERROR -  /builds/worker/checkouts/gecko/dom/indexedDB/ProfilerHelpers.h:69:67: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'nsresult' [-Werror=format=]
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -                                            _loggingId, ##__VA_ARGS__)
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -                                                                     ^
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ProfilerHelpers.h:129:3: note: in expansion of macro 'IDB_LOG_MARK'
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -     IDB_LOG_MARK(                                                              \
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -     ^~~~~~~~~~~~
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ProfilerHelpers.h:136:3: note: in expansion of macro 'IDB_LOG_MARK_TRANSACTION'
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -     IDB_LOG_MARK_TRANSACTION(                                                    \
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -     ^~~~~~~~~~~~~~~~~~~~~~~~
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp:23125:3: note: in expansion of macro 'IDB_LOG_MARK_PARENT_TRANSACTION'
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -     IDB_LOG_MARK_PARENT_TRANSACTION(
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -     ^
[task 2020-07-03T08:45:00.021Z] 08:45:00    ERROR -  /builds/worker/checkouts/gecko/dom/indexedDB/ProfilerHelpers.h:69:67: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'nsresult' [-Werror=format=]
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -                                            _loggingId, ##__VA_ARGS__)
[task 2020-07-03T08:45:00.021Z] 08:45:00     INFO -                                                                     ^
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ProfilerHelpers.h:129:3: note: in expansion of macro 'IDB_LOG_MARK'
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -     IDB_LOG_MARK(                                                              \
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -     ^~~~~~~~~~~~
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ProfilerHelpers.h:136:3: note: in expansion of macro 'IDB_LOG_MARK_TRANSACTION'
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -     IDB_LOG_MARK_TRANSACTION(                                                    \
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -     ^~~~~~~~~~~~~~~~~~~~~~~~
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp:23125:3: note: in expansion of macro 'IDB_LOG_MARK_PARENT_TRANSACTION'
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -     IDB_LOG_MARK_PARENT_TRANSACTION(
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -     ^
[task 2020-07-03T08:45:00.032Z] 08:45:00     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:14:0,
[task 2020-07-03T08:45:00.034Z] 08:45:00     INFO -                   from /builds/worker/workspace/obj-build/dist/include/nsCOMPtr.h:26,
[task 2020-07-03T08:45:00.034Z] 08:45:00     INFO -                   from /builds/worker/workspace/obj-build/dist/include/mozilla/dom/indexedDB/PermissionRequestBase.h:11,
[task 2020-07-03T08:45:00.034Z] 08:45:00     INFO -                   from /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.h:14,
[task 2020-07-03T08:45:00.034Z] 08:45:00     INFO -                   from /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp:7:
[task 2020-07-03T08:45:00.034Z] 08:45:00     INFO -  /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h: In function 'nsresult mozilla::dom::indexedDB::{anonymous}::RemoveDatabaseFilesAndDirectory(nsIFile&, const nsAString&, mozilla::dom::quota::QuotaManager*, mozilla::dom::quota::PersistenceType, const nsACString&, const nsACString&, const nsAString&)':
[task 2020-07-03T08:45:00.035Z] 08:45:00  WARNING -  /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:464:5: warning: 'usage' may be used uninitialized in this function [-Wmaybe-uninitialized]
[task 2020-07-03T08:45:00.035Z] 08:45:00     INFO -       if (MOZ_UNLIKELY(!MOZ_CHECK_ASSERT_ASSIGNMENT(expr))) {    \
[task 2020-07-03T08:45:00.035Z] 08:45:00     INFO -       ^~
[task 2020-07-03T08:45:00.035Z] 08:45:00     INFO -  /builds/worker/checkouts/gecko/dom/indexedDB/ActorsParent.cpp:9509:14: note: 'usage' was declared here
[task 2020-07-03T08:45:00.035Z] 08:45:00     INFO -       uint64_t usage;
[task 2020-07-03T08:45:00.035Z] 08:45:00     INFO -                ^~~~~
Flags: needinfo?(sgiesecke)
Status: NEW → ASSIGNED
Flags: needinfo?(sgiesecke)

Sorry for that, that was a base toolchain / gcc build again :( I fixed it and will re-land soon.

Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cffb57350b4c Move ProfilerHelpers implementation into cpp file. r=dom-workers-and-storage-reviewers,asuth https://hg.mozilla.org/integration/autoland/rev/6acf3db33ae9 Fix bad printf format strings/argument lists. r=dom-workers-and-storage-reviewers,asuth https://hg.mozilla.org/integration/autoland/rev/4a9857f002e5 Convert IDB_LOG_MARK2 into a proper function. r=dom-workers-and-storage-reviewers,asuth https://hg.mozilla.org/integration/autoland/rev/bb6e16492438 Clean up ThreadLocal. r=dom-workers-and-storage-reviewers,asuth
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: