From: Steve Magnani <steve.magnani@digidescorp.com>
To: Jan Kara <jack@suse.com>, linux-kernel@vger.kernel.org
Cc: "Steven J . Magnani" <steve@digidescorp.com>
Subject: [PATCH v2 0/3] udf: Fix some signed/unsigned conversion issues
Date: Thu, 12 Oct 2017 08:48:39 -0500 [thread overview]
Message-ID: <1507816122-19405-1-git-send-email-steve@digidescorp.com> (raw)
The UDF driver has several points at which conversion between unsigned and
signed types cause (or could cause) problems. On 64-bit systems,
conversion of block addresses larger than 0x7FFFFFFF (>= 1 TiB when
blocksize is 512 bytes) can involve undesired sign extension that corrupts
the block address value. This is known to cause the following problems:
* readdir() can fail on a directory containing File Identifiers residing
above 0x7FFFFFFF. This manifests as a 'ls' command failing with EIO.
* FIBMAP on a file block located above 0x7FFFFFFF can return a negative
value. The low 32 bits are correct, but applications that don't mask the
high 32 bits of the result can perform incorrectly.
Additionally, large unsigned values can be printed as negative numbers,
for example:
Partition (0 type 1511) starts at physical 460, block length -1779968542
Take care to use unsigned types to store UDF block addresses and to use
format specifiers that match the signedness of the values they are to
print.
Changes since V1:
* Separated printing fixes from sign extension fixes
* Implemented suggested udf_pblk_t typedef for representation of
block addresses and use it in place of 'uint32_t' for changes in this
patch series
* Converted some uint32_t block address variables in inode_getblk() to
udf_pblk_t
* Fixed additional signed/unsigned type mismatches in:
- udf_table_new_block()
- udf_fileident_read()
- udf_new_inode()
- udf_split_extents()
- udf_getblk()
- udf_do_extend_file()
- udf_bread()
- udf_setsize()
- udf_setup_indirect_aext()
- udf_add_aext()
- extent_trunc()
Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
next reply other threads:[~2017-10-12 13:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 13:48 Steve Magnani [this message]
2017-10-12 13:48 ` [PATCH v2 1/3] udf: Fix 64-bit sign extension issues affecting blocks > 0x7FFFFFFF Steve Magnani
2017-10-16 14:17 ` Jan Kara
2017-10-16 19:20 ` Steve Magnani
2017-10-12 13:48 ` [PATCH v2 2/3] udf: Fix signed/unsigned format specifiers Steve Magnani
2017-10-12 13:48 ` [PATCH v2 3/3] udf: Fix some sign-conversion warnings Steve Magnani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507816122-19405-1-git-send-email-steve@digidescorp.com \
--to=steve.magnani@digidescorp.com \
--cc=jack@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steve@digidescorp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome