mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
When available, use posix_fallocate() rather than ftruncate() to allocate
space for mmap()ed -shm files, since posix_fallocate() gives an error if no disk space is available whereas ftruncate() is silent and leaves the system vulnerable to a SIGBUS upon first write to the mmap()ed region. Ticket [5eaa61ea1881040b17449ca043b6f8fd9ca55dc3] FossilOrigin-Name: 356259617cfad04492a02912fdf781f54a2b4494
This commit is contained in:
17
manifest
17
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Only\slog\sunlink()\serrors\sif\sthe\serror\sis\ssomething\sother\sthan\nSQLITE_IOERR_DELETE_NOENT.\s\sThe\serror\sis\sstill\sreported\sup\sthe\sstack,\sit\nis\ssimply\snot\sadded\sto\sthe\ssqlite3_log().
|
C When\savailable,\suse\sposix_fallocate()\srather\sthan\sftruncate()\sto\sallocate\nspace\sfor\smmap()ed\s-shm\sfiles,\ssince\sposix_fallocate()\sgives\san\serror\sif\nno\sdisk\sspace\sis\savailable\swhereas\sftruncate()\sis\ssilent\sand\sleaves\sthe\ssystem\nvulnerable\sto\sa\sSIGBUS\supon\sfirst\swrite\sto\sthe\smmap()ed\sregion.\nTicket\s[5eaa61ea1881040b17449ca043b6f8fd9ca55dc3]
|
||||||
D 2012-11-09T21:40:02.069
|
D 2012-11-13T10:54:12.768
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 82c41c0ed4cc94dd3cc7d498575b84c57c2c2384
|
F Makefile.in 82c41c0ed4cc94dd3cc7d498575b84c57c2c2384
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -160,7 +160,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
|
|||||||
F src/os.c e1acdc09ff3ac2412945cca9766e2dcf4675f31c
|
F src/os.c e1acdc09ff3ac2412945cca9766e2dcf4675f31c
|
||||||
F src/os.h 027491c77d2404c0a678bb3fb06286f331eb9b57
|
F src/os.h 027491c77d2404c0a678bb3fb06286f331eb9b57
|
||||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||||
F src/os_unix.c f0753566e1125d8b2eef6dd080b48ed91a83d424
|
F src/os_unix.c fad4c9cbf89aa5e5de1f5972458c39bd75418b16
|
||||||
F src/os_win.c 43ec1285357e5d5d919cb0492eac775c58ad7d12
|
F src/os_win.c 43ec1285357e5d5d919cb0492eac775c58ad7d12
|
||||||
F src/pager.c ed53fe75a269c1d67645fe079ea0f3f0ce6492d5
|
F src/pager.c ed53fe75a269c1d67645fe079ea0f3f0ce6492d5
|
||||||
F src/pager.h 1109a06578ec5574dc2c74cf8d9f69daf36fe3e0
|
F src/pager.h 1109a06578ec5574dc2c74cf8d9f69daf36fe3e0
|
||||||
@@ -943,7 +943,7 @@ F test/wal5.test f58ed4b8b542f71c7441da12fbd769d99b362437
|
|||||||
F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
|
F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
|
||||||
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
|
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
|
||||||
F test/wal8.test b3ee739fe8f7586aaebdc2367f477ebcf3e3b034
|
F test/wal8.test b3ee739fe8f7586aaebdc2367f477ebcf3e3b034
|
||||||
F test/wal9.test b4eb5d27170c65ee9c8ff9c9e76babd902a13cfc
|
F test/wal9.test 48c40803faf6849515c81213697e9f3376835981
|
||||||
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
|
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
|
||||||
F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877
|
F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877
|
||||||
F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434
|
F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434
|
||||||
@@ -1024,7 +1024,10 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||||
P bed9c172ce624ab7b5b9de9ad42444891717ad9a
|
P 5a3b07f0f5dfae7eea870303f52f37d6a17f1da2
|
||||||
R 6c7c8f8d3a3d00e4614865ddb6f518c4
|
R 457e538f0280386531160ea4b104ea9e
|
||||||
|
T *branch * tkt-5eaa61ea18
|
||||||
|
T *sym-tkt-5eaa61ea18 *
|
||||||
|
T -sym-trunk *
|
||||||
U drh
|
U drh
|
||||||
Z 81d94dfa08446549954e693bf8235ef9
|
Z 97e3b0ff73b00a5f41754576708d0771
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
5a3b07f0f5dfae7eea870303f52f37d6a17f1da2
|
356259617cfad04492a02912fdf781f54a2b4494
|
||||||
@@ -4168,11 +4168,19 @@ static int unixShmMap(
|
|||||||
** the requested memory region.
|
** the requested memory region.
|
||||||
*/
|
*/
|
||||||
if( !bExtend ) goto shmpage_out;
|
if( !bExtend ) goto shmpage_out;
|
||||||
|
#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
|
||||||
|
if( osFallocate(pShmNode->h, sStat.st_size, nByte)!=0 ){
|
||||||
|
rc = unixLogError(SQLITE_IOERR_SHMSIZE, "fallocate",
|
||||||
|
pShmNode->zFilename);
|
||||||
|
goto shmpage_out;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if( robust_ftruncate(pShmNode->h, nByte) ){
|
if( robust_ftruncate(pShmNode->h, nByte) ){
|
||||||
rc = unixLogError(SQLITE_IOERR_SHMSIZE, "ftruncate",
|
rc = unixLogError(SQLITE_IOERR_SHMSIZE, "ftruncate",
|
||||||
pShmNode->zFilename);
|
pShmNode->zFilename);
|
||||||
goto shmpage_out;
|
goto shmpage_out;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ do_execsql_test 1.2 {
|
|||||||
# the *shm file is now more than one chunk (>32KiB).
|
# the *shm file is now more than one chunk (>32KiB).
|
||||||
do_test 1.3 { file size test.db } {1024}
|
do_test 1.3 { file size test.db } {1024}
|
||||||
do_test 1.4 { file size test.db-wal } {15421352}
|
do_test 1.4 { file size test.db-wal } {15421352}
|
||||||
do_test 1.5 { file size test.db-shm } {131072}
|
do_test 1.5 { expr {[file size test.db-shm]>32768} } {1}
|
||||||
|
|
||||||
do_execsql_test 1.6 { PRAGMA wal_checkpoint } {0 14715 14715}
|
do_execsql_test 1.6 { PRAGMA wal_checkpoint } {0 14715 14715}
|
||||||
|
|
||||||
@@ -87,4 +87,3 @@ do_test 1.7 {
|
|||||||
db2 close
|
db2 close
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user