ACPI: pfr_telemetry: Fix info leak in pfrt_log_ioctl()
Subsystems (2)
PATCH 1/1 ACPI: pfr_telemetry: Fix info leak in pfrt_log_ioctl()
The "data_info" struct is copied to the user. It has a 4 byte struct hole after the last struct member so we need to memset that to avoid copying uninitialized stack data to the user.
---
When you're adding a new driver to the kernel then please use the new driver's prefix instead of just the subsystem prefix.
Bad: ACPI: Introduce Platform Firmware Runtime Telemetry driver
Good: ACPI / pfr_telemetry: Introduce Platform Firmware Runtime Telemetry driver
Otherwise it's just up to me to guess what prefix you wanted.
drivers/acpi/pfr_telemetry.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/pfr_telemetry.c +1 -0
@@ -83,6 +83,7 @@ static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info,union acpi_object *out_obj, in_obj, in_buf;int ret = -EBUSY ; +memset (data_info,0 ,sizeof (*data_info));memset (&in_obj,0 ,sizeof (in_obj));memset (&in_buf,0 ,sizeof (in_buf)); in_obj.type =ACPI_TYPE_PACKAGE ;
Signature · 1 line
2.20.1
Quoted 4 lines · Dan Carpenter
The "
data_info" struct is copied to the user. It has a 4 byte struct hole after the last struct member so we need to memset that to avoid copying uninitialized stack data to the user.
Quoted 9 lines
Fixes b0013e037a8b ("ACPI: Introduce Platform Firmware Runtime Telemetry driver")Signed-off-by Dan Carpenter <[email protected]>---
When you're adding a new driver to the kernel then please use the new driver's prefix instead of just the subsystem prefix.Bad: ACPI: Introduce Platform Firmware Runtime Telemetry driver
Good: ACPI /pfr_telemetry: Introduce Platform Firmware Runtime Telemetry driver
Thanks for pointing this out.
Quoted 10 lines
Otherwise it's just up to me to guess what prefix you wanted.
drivers/acpi/pfr_telemetry.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/pfr_telemetry.c +0
-0
drivers/acpi/pfr_telemetry.c static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info, · line 86
Quoted 4 lines
drivers/acpi/pfr_telemetry.c +1
-0@@ -83,6 +83,7 @@ static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info,union acpi_object *out_obj, in_obj, in_buf;int ret = -EBUSY ; +memset (data_info,0 ,sizeof (*data_info));
Just one minor question, how about moving above before:data_info->status = out_obj->package.elements[LOG_STATUS_IDX].integer.value; after the sanity check of the _DSM result?
thanks,
Chenyu
Quoted 3 lines
drivers/acpi/pfr_telemetry.c +0
-0memset (&in_obj,0 ,sizeof (in_obj));memset (&in_buf,0 ,sizeof (in_buf)); in_obj.type =ACPI_TYPE_PACKAGE ;
Quoted 28 lines · Chen Yu
Quoted 4 lines · Dan Carpenter
The "
data_info" struct is copied to the user. It has a 4 byte struct hole after the last struct member so we need to memset that to avoid copying uninitialized stack data to the user.Quoted 9 lines
Fixes b0013e037a8b ("ACPI: Introduce Platform Firmware Runtime Telemetry driver")Signed-off-by Dan Carpenter <[email protected]>---
When you're adding a new driver to the kernel then please use the new driver's prefix instead of just the subsystem prefix.Bad: ACPI: Introduce Platform Firmware Runtime Telemetry driver
Good: ACPI /pfr_telemetry: Introduce Platform Firmware Runtime Telemetry driverThanks for pointing this out.
Quoted 13 lines
Otherwise it's just up to me to guess what prefix you wanted.
drivers/acpi/pfr_telemetry.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/pfr_telemetry.c +0
-0@@ -83,6 +83,7 @@ static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info,union acpi_object *out_obj, in_obj, in_buf;int ret = -EBUSY ;
Quoted 4 lines
drivers/acpi/pfr_telemetry.c static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info, · line 86
Quoted 1 line
drivers/acpi/pfr_telemetry.c +1
-0+memset (data_info,0 ,sizeof (*data_info));Just one minor question, how about moving above before:
data_info->status= out_obj->package.elements[LOG_STATUS_IDX].integer.value; after the sanity check of the_DSMresult?
I guess I wanted to keep all the memsets together. I feel like if the data is invalid, then it's going to be a slow path and it's not worth optimizing that case. If the data is invalid then a little slow down is the least of our concerns.
regards,
dan carpenter
Rafael J. Wysocki
maintainerQuoted 35 lines · Dan Carpenter
Quoted 28 lines · Chen Yu
Quoted 4 lines · Dan Carpenter
The "
data_info" struct is copied to the user. It has a 4 byte struct hole after the last struct member so we need to memset that to avoid copying uninitialized stack data to the user.Quoted 9 lines
Fixes b0013e037a8b ("ACPI: Introduce Platform Firmware Runtime Telemetry driver")Signed-off-by Dan Carpenter <[email protected]>---
When you're adding a new driver to the kernel then please use the new driver's prefix instead of just the subsystem prefix.Bad: ACPI: Introduce Platform Firmware Runtime Telemetry driver
Good: ACPI /pfr_telemetry: Introduce Platform Firmware Runtime Telemetry driverThanks for pointing this out.
Quoted 13 lines
Otherwise it's just up to me to guess what prefix you wanted.
drivers/acpi/pfr_telemetry.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/pfr_telemetry.c +0
-0@@ -83,6 +83,7 @@ static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info,union acpi_object *out_obj, in_obj, in_buf;int ret = -EBUSY ;Quoted 4 lines
drivers/acpi/pfr_telemetry.c static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info, · line 86
Quoted 1 line
drivers/acpi/pfr_telemetry.c +1
-0+memset (data_info,0 ,sizeof (*data_info));Just one minor question, how about moving above before:
data_info->status= out_obj->package.elements[LOG_STATUS_IDX].integer.value; after the sanity check of the_DSMresult?
Quoted 4 lines
I guess I wanted to keep all the memsets together. I feel like if the data is invalid, then it's going to be a slow path and it's not worth optimizing that case. If the data is invalid then a little slow down is the least of our concerns.
Patch applied, thanks!
Yu, this series needs to spend a few days more in linux-next, because of the fixes against it sent lately.
Quoted 34 lines · Dan Carpenter
Quoted 28 lines · Chen Yu
Quoted 4 lines · Dan Carpenter
The "
data_info" struct is copied to the user. It has a 4 byte struct hole after the last struct member so we need to memset that to avoid copying uninitialized stack data to the user.Quoted 9 lines
Fixes b0013e037a8b ("ACPI: Introduce Platform Firmware Runtime Telemetry driver")Signed-off-by Dan Carpenter <[email protected]>---
When you're adding a new driver to the kernel then please use the new driver's prefix instead of just the subsystem prefix.Bad: ACPI: Introduce Platform Firmware Runtime Telemetry driver
Good: ACPI /pfr_telemetry: Introduce Platform Firmware Runtime Telemetry driverThanks for pointing this out.
Quoted 13 lines
Otherwise it's just up to me to guess what prefix you wanted.
drivers/acpi/pfr_telemetry.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/pfr_telemetry.c +0
-0@@ -83,6 +83,7 @@ static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info,union acpi_object *out_obj, in_obj, in_buf;int ret = -EBUSY ;Quoted 4 lines
drivers/acpi/pfr_telemetry.c static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info, · line 86
Quoted 1 line
drivers/acpi/pfr_telemetry.c +1
-0+memset (data_info,0 ,sizeof (*data_info));Just one minor question, how about moving above before:
data_info->status= out_obj->package.elements[LOG_STATUS_IDX].integer.value; after the sanity check of the_DSMresult?
Quoted 5 lines
I guess I wanted to keep all the memsets together. I feel like if the data is invalid, then it's going to be a slow path and it's not worth optimizing that case. If the data is invalid then a little slow down is the least of our concerns.
Ok, got it.
thanks,
Chenyu
Quoted 1 line
Quoted 41 lines · Rafael J. Wysocki
Quoted 35 lines · Dan Carpenter
Quoted 28 lines · Chen Yu
Quoted 4 lines · Dan Carpenter
The "
data_info" struct is copied to the user. It has a 4 byte struct hole after the last struct member so we need to memset that to avoid copying uninitialized stack data to the user.Quoted 9 lines
Fixes b0013e037a8b ("ACPI: Introduce Platform Firmware Runtime Telemetry driver")Signed-off-by Dan Carpenter <[email protected]>---
When you're adding a new driver to the kernel then please use the new driver's prefix instead of just the subsystem prefix.Bad: ACPI: Introduce Platform Firmware Runtime Telemetry driver
Good: ACPI /pfr_telemetry: Introduce Platform Firmware Runtime Telemetry driverThanks for pointing this out.
Quoted 13 lines
Otherwise it's just up to me to guess what prefix you wanted.
drivers/acpi/pfr_telemetry.c | 1 + 1 file changed, 1 insertion(+)drivers/acpi/pfr_telemetry.c +0
-0@@ -83,6 +83,7 @@ static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info,union acpi_object *out_obj, in_obj, in_buf;int ret = -EBUSY ;Quoted 4 lines
drivers/acpi/pfr_telemetry.c static int get_pfrt_log_data_info(struct pfrt_log_data_info *data_info, · line 86
Quoted 1 line
drivers/acpi/pfr_telemetry.c +1
-0+memset (data_info,0 ,sizeof (*data_info));Just one minor question, how about moving above before:
data_info->status= out_obj->package.elements[LOG_STATUS_IDX].integer.value; after the sanity check of the_DSMresult?Quoted 4 lines
I guess I wanted to keep all the memsets together. I feel like if the data is invalid, then it's going to be a slow path and it's not worth optimizing that case. If the data is invalid then a little slow down is the least of our concerns.
Quoted 4 lines
Patch applied, thanks!
Yu, this series needs to spend a few days more in linux-next, because of the fixes against it sent lately.
Ok, I see.
thanks,
Chenyu