Bug 2231204

Summary: REDHAT 8.8 version sgpio tool report buffer overflow when set the dis led status
Product: Red Hat Enterprise Linux 8 Reporter: wangdong28 <wangdong28>
Component: sgpioAssignee: Lukáš Nykrýn <lnykryn>
Status: NEW --- QA Contact: qe-baseos-daemons
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.8CC: ahuang12, wangdong28
Target Milestone: rcKeywords: SubBug
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description wangdong28 2023-08-11 02:19:51 UTC
Description of problem:
when use sgpio do the led status test, some disk will report this error:
[dong@localhost sgpio]$ ./sgpio -d sdc -s locate
*** buffer overflow detected ***: ./sgpio terminated

Through testing, it is the sgpio code bug.

Version-Release number of selected component (if applicable):
Tested 8.6 and 8.8, they all have issue

How reproducible:
connect 10 SATA disk to server and than perform the sgpio cmd.

Steps to Reproduce:
1.connect 10 disks on server
2.find the port num > 10 disk(>10 is necessary condition to trigger this err), such as follow sdc
[dong@localhost ~]$ lsscsi 
[0:2:0:0]    disk    Lenovo   RAID 730-8i 1GB  4.68  /dev/sda 
[15:0:0:0]   disk    ATA      ThinkSystem M.2  00-0  /dev/sdc 
[17:0:0:0]   process Marvell  Console          1.01  -        
[18:2:0:0]   disk    Lenovo   RAID 730-8i 1GB  4.68  /dev/sdb 
[19:0:0:0]   cd/dvd  XCC      Virtual Media    0399  /dev/sr0 
3.perform sgpio cmd: sgpio -d sdc -s locate

Actual results:
sgpio -d sdc -s locate will report overflow err

Expected results:
sgpio -d sdc -s locate will show the right led flashing

Additional info:
we have traced the root cause, in sgpio soure code in function led_set:
        if(sprintf(disks[index].name,"Port %d", port_num) < 0){
		printf("Error: Unable to write port number to buffor!\n");
		return -1;
	}
name is char name[7], and once the disk num exceed 9, it will cause out of bound issue, please set the array as the 11 to avoid this issue.

Comment 1 wangdong28 2023-08-14 02:57:04 UTC
Hi,
Anything update?

Comment 2 Lukáš Nykrýn 2023-08-15 06:18:34 UTC
Hello, given the low priority of this component, the fact that this tool is not used in productions and the fact we are at the end of our development of 8.9 I don't expect we will work on this anytime soon.

Comment 3 wangdong28 2023-08-15 06:27:20 UTC
Hello, so this issue won't fix in two weeks right? Do we have any plan to fix this issue in the future redhat release version?

Comment 4 Lukáš Nykrýn 2023-08-15 06:52:49 UTC
Two weeks are not realistic. Right now, doable timeline is rhel-8.10 and rhel-9.4

Comment 5 wangdong28 2023-08-15 07:06:16 UTC
ok, has set the Severity as low