bugHddtemp - Bugs: bug #58582, [PATCH] segfault fix

 
 

bug #58582: [PATCH] segfault fix

Submitter:  Michael Shigorin <shigorin>
Submitted:  Tue 16 Jun 2020 10:35:54 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 Jun 2020 11:17:34 AM UTC, comment #1: 
Michael Shigorin <shigorin>
Tue 16 Jun 2020 10:35:54 AM UTC, original submission:  

hddtemp -nq -u C /dev/sda would segfault on HDD (but not on SSD) in a few tests conveyed; here's a patch by Vitaly Chikunov who stumbled upon this bug with 0.3-beta15 (gets included in ALT Linux package).

Citing the original bugreport:

5.4.41-std-def-alt1:~# /usr/sbin/hddtemp -nq -u C /dev/sda
Segmentation fault

5.4.41-std-def-alt1:~# gdb --args /usr/sbin/hddtemp -nq -u C /dev/sda
GNU gdb (GDB) 8.3-alt2 (ALT Sisyphus)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-alt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/hddtemp...
Reading symbols from /usr/lib/debug/usr/sbin/hddtemp.debug...
(gdb) r
Starting program: /usr/sbin/hddtemp -nq -u C /dev/sda

Program received signal SIGSEGV, Segmentation fault.
0x00000000004053bc in value_to_unit (dsk=0xae1740) at hddtemp.c:97
97          if(dsk->db_entry->unit == 'F')
   0x00000000004053b8 <value_to_unit+40>:       48 8b 57 28     mov    0x28(%rdi),%rdx
=> 0x00000000004053bc <value_to_unit+44>:       80 7a 18 46     cmpb   $0x46,0x18(%rdx)
   0x00000000004053c0 <value_to_unit+48>:       75 eb   jne    0x4053ad <value_to_unit+29>
(gdb) bt
#0  0x00000000004053bc in value_to_unit (dsk=0xae1740) at hddtemp.c:97
#1  0x0000000000405650 in display_temperature (dsk=0xae1740) at hddtemp.c:213
#2  do_direct_mode (ldisks=<optimized out>) at hddtemp.c:257
#3  0x0000000000403b12 in main (argc=<optimized out>, argv=0x7fffaa5b37b8) at hddtemp.c:530
(gdb) p dsk
$1 = (struct disk *) 0xae1740
(gdb) p dsk->db_entry
$2 = (struct harddrive_entry *) 0x0
(gdb)

See-also: http://bugzilla.altlinux.org/38616 (Russian)
See-also: http://git.altlinux.org/people/vt/packages/hddtemp.git?p=hddtemp.git;a=blob;f=0001-Prevent-crash-on-numeric-unit-conversion-when-disk-i.patch;h=81d693fe8fab6fd7a7ee05b098af5aff1f1dc14f;hb=ab353c538d79d6ca137e4aef9507cf9ef6378c51

Michael Shigorin <shigorin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49277:  0001-Prevent-crash-on-numeric-unit-conversion-when-disk-i.patch added by shigorin (1KiB - text/x-patch - patch by -email is unavailable-)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by shigorin (Submitted the item)
  • -email is unavailable- added by shigorin (hddtemp patch proposed upstream)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-16 shigorin Attached File- Added 0001-Prevent-crash-on-numeric-unit-conversion-when-disk-i.patch, #49277
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code