Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionMasahiro Matsuya
2022-01-24 02:52:07 UTC
Description of problem:
sgpio command aborted with *** buffer overflow detected ***
The following stacktrace was output.
systemd-coredump[XXXX]: Process XXXX (sgpio) of user 0 dumped core.#012#012
Stack trace of thread 39201:#012
#0 0x00007fcf5d06c37f raise (libc.so.6)#012
#1 0x00007fcf5d056db5 abort (libc.so.6)#012
#2 0x00007fcf5d0af4e7 __libc_message (libc.so.6)#012
#3 0x00007fcf5d142365 __GI___fortify_fail_abort (libc.so.6)#012
#4 0x00007fcf5d142397 __fortify_fail (libc.so.6)#012
#5 0x00007fcf5d140356 __chk_fail (libc.so.6)#012
#6 0x00007fcf5d13f9bf _IO_str_chk_overflow (libc.so.6)#012
#7 0x00007fcf5d0b3611 _IO_default_xsputn (libc.so.6)#012
#8 0x00007fcf5d085dc8 vfprintf (libc.so.6)#012
#9 0x00007fcf5d13fa63 __vsprintf_chk (libc.so.6)#012
#10 0x00007fcf5d13f98e __sprintf_chk (libc.so.6)#012
#11 0x0000556a44c85bd9 led_set (sgpio)#012
#12 0x0000556a44c850f3 main (sgpio)#012
#13 0x00007fcf5d058493 __libc_start_main (libc.so.6)#012
#14 0x0000556a44c8565e _start (sgpio)
This following is the relative code.
struct disk{
struct led_context data[LEDS_PER_DISK];
int id;
int host_port;
int init;
char name[7];
};
... snip ...
int led_set(int port_num){
... snip ...
/* Give the port a name */
if(sprintf(disks[index].name,"Port %d", port_num) < 0){
printf("Error: Unable to write port number to buffor!\n");
return -1;
}
The name member of the struct disk is the char type array with 7 length.
Basically, last one name[6] should be \0.
So, the name member can be used for almost 6 characters.
The "Port %d" can be more than 7 characters, when the port number length is more than 2. So, the buffer overflow was detected and aborted.
The following is the simple fix.
$ cat sgpio-larger-portnum.patch
diff -up sgpio/sgpio.c.original sgpio/sgpio.c
--- sgpio/sgpio.c.original 2022-01-24 11:20:31.486061764 +0900
+++ sgpio/sgpio.c 2022-01-24 11:23:00.677783531 +0900
@@ -126,7 +126,7 @@ struct disk{
int id;
int host_port;
int init;
- char name[7];
+ char name[8];
};
/* structure for the disks associated with the led structure */
Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux 8.5
How reproducible:
Always with the scsi port number of more than 2 digits.
Steps to Reproduce:
1. Find a disk with the scsi port number of more than 2 digits.
2. Run sgpio -d <device> -s locate
<device> is something like sda
Actual results:
sgpio command aborted.
Expected results:
sgpio command never aborted.
Additional info:
Comment 3RHEL Program Management
2023-07-24 07:28:26 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.
Description of problem: sgpio command aborted with *** buffer overflow detected *** The following stacktrace was output. systemd-coredump[XXXX]: Process XXXX (sgpio) of user 0 dumped core.#012#012 Stack trace of thread 39201:#012 #0 0x00007fcf5d06c37f raise (libc.so.6)#012 #1 0x00007fcf5d056db5 abort (libc.so.6)#012 #2 0x00007fcf5d0af4e7 __libc_message (libc.so.6)#012 #3 0x00007fcf5d142365 __GI___fortify_fail_abort (libc.so.6)#012 #4 0x00007fcf5d142397 __fortify_fail (libc.so.6)#012 #5 0x00007fcf5d140356 __chk_fail (libc.so.6)#012 #6 0x00007fcf5d13f9bf _IO_str_chk_overflow (libc.so.6)#012 #7 0x00007fcf5d0b3611 _IO_default_xsputn (libc.so.6)#012 #8 0x00007fcf5d085dc8 vfprintf (libc.so.6)#012 #9 0x00007fcf5d13fa63 __vsprintf_chk (libc.so.6)#012 #10 0x00007fcf5d13f98e __sprintf_chk (libc.so.6)#012 #11 0x0000556a44c85bd9 led_set (sgpio)#012 #12 0x0000556a44c850f3 main (sgpio)#012 #13 0x00007fcf5d058493 __libc_start_main (libc.so.6)#012 #14 0x0000556a44c8565e _start (sgpio) This following is the relative code. struct disk{ struct led_context data[LEDS_PER_DISK]; int id; int host_port; int init; char name[7]; }; ... snip ... int led_set(int port_num){ ... snip ... /* Give the port a name */ if(sprintf(disks[index].name,"Port %d", port_num) < 0){ printf("Error: Unable to write port number to buffor!\n"); return -1; } The name member of the struct disk is the char type array with 7 length. Basically, last one name[6] should be \0. So, the name member can be used for almost 6 characters. The "Port %d" can be more than 7 characters, when the port number length is more than 2. So, the buffer overflow was detected and aborted. The following is the simple fix. $ cat sgpio-larger-portnum.patch diff -up sgpio/sgpio.c.original sgpio/sgpio.c --- sgpio/sgpio.c.original 2022-01-24 11:20:31.486061764 +0900 +++ sgpio/sgpio.c 2022-01-24 11:23:00.677783531 +0900 @@ -126,7 +126,7 @@ struct disk{ int id; int host_port; int init; - char name[7]; + char name[8]; }; /* structure for the disks associated with the led structure */ Version-Release number of selected component (if applicable): Red Hat Enterprise Linux 8.5 How reproducible: Always with the scsi port number of more than 2 digits. Steps to Reproduce: 1. Find a disk with the scsi port number of more than 2 digits. 2. Run sgpio -d <device> -s locate <device> is something like sda Actual results: sgpio command aborted. Expected results: sgpio command never aborted. Additional info: