All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23  3:55 ` Guo Zhi
  0 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-23  3:55 UTC (permalink / raw)
  To: nsaenz, gregkh, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel, Guo Zhi

Pointers should be printed with %p or %px rather than
cast to (unsigned long) and printed with %lx.
Change %lx to %pK to print the pointers.

Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index b5aac862a29..408e5fe710b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
 		return VCHIQ_SUCCESS;
 
 	vchiq_log_trace(vchiq_arm_log_level,
-		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
-		__func__, (unsigned long)user_service,
+		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
+		__func__, user_service,
 		service->localport, user_service->userdata,
-		reason, (unsigned long)header,
-		(unsigned long)instance, (unsigned long)bulk_userdata);
+		reason, header,
+		instance, bulk_userdata);
 
 	if (header && user_service->is_vchi) {
 		spin_lock(&msg_queue_spinlock);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23  3:55 ` Guo Zhi
  0 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-23  3:55 UTC (permalink / raw)
  To: nsaenz, gregkh, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel, Guo Zhi

Pointers should be printed with %p or %px rather than
cast to (unsigned long) and printed with %lx.
Change %lx to %pK to print the pointers.

Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index b5aac862a29..408e5fe710b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
 		return VCHIQ_SUCCESS;
 
 	vchiq_log_trace(vchiq_arm_log_level,
-		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
-		__func__, (unsigned long)user_service,
+		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
+		__func__, user_service,
 		service->localport, user_service->userdata,
-		reason, (unsigned long)header,
-		(unsigned long)instance, (unsigned long)bulk_userdata);
+		reason, header,
+		instance, bulk_userdata);
 
 	if (header && user_service->is_vchi) {
 		spin_lock(&msg_queue_spinlock);
-- 
2.33.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
  2021-09-23  3:55 ` Guo Zhi
@ 2021-09-23  5:19   ` Greg KH
  -1 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2021-09-23  5:19 UTC (permalink / raw)
  To: Guo Zhi
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index b5aac862a29..408e5fe710b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>  		return VCHIQ_SUCCESS;
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
> -		__func__, (unsigned long)user_service,
> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
> +		__func__, user_service,
>  		service->localport, user_service->userdata,
> -		reason, (unsigned long)header,
> -		(unsigned long)instance, (unsigned long)bulk_userdata);
> +		reason, header,
> +		instance, bulk_userdata);

Why print this out at all?  What uses this?  Can it just be deleted?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23  5:19   ` Greg KH
  0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2021-09-23  5:19 UTC (permalink / raw)
  To: Guo Zhi
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index b5aac862a29..408e5fe710b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>  		return VCHIQ_SUCCESS;
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
> -		__func__, (unsigned long)user_service,
> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
> +		__func__, user_service,
>  		service->localport, user_service->userdata,
> -		reason, (unsigned long)header,
> -		(unsigned long)instance, (unsigned long)bulk_userdata);
> +		reason, header,
> +		instance, bulk_userdata);

Why print this out at all?  What uses this?  Can it just be deleted?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
  2021-09-23  5:19   ` Greg KH
@ 2021-09-23 10:20     ` Stefan Wahren
  -1 siblings, 0 replies; 15+ messages in thread
From: Stefan Wahren @ 2021-09-23 10:20 UTC (permalink / raw)
  To: Greg KH, Guo Zhi, Phil Elwell
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

Add Phil

Am 23.09.21 um 07:19 schrieb Greg KH:
> On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
>> Pointers should be printed with %p or %px rather than
>> cast to (unsigned long) and printed with %lx.
>> Change %lx to %pK to print the pointers.
>>
>> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
>> ---
>>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index b5aac862a29..408e5fe710b 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>>  		return VCHIQ_SUCCESS;
>>  
>>  	vchiq_log_trace(vchiq_arm_log_level,
>> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
>> -		__func__, (unsigned long)user_service,
>> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
>> +		__func__, user_service,
>>  		service->localport, user_service->userdata,
>> -		reason, (unsigned long)header,
>> -		(unsigned long)instance, (unsigned long)bulk_userdata);
>> +		reason, header,
>> +		instance, bulk_userdata);
> Why print this out at all?  What uses this?  Can it just be deleted?
>
> thanks,
>
> greg k-h
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23 10:20     ` Stefan Wahren
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Wahren @ 2021-09-23 10:20 UTC (permalink / raw)
  To: Greg KH, Guo Zhi, Phil Elwell
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

Add Phil

Am 23.09.21 um 07:19 schrieb Greg KH:
> On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
>> Pointers should be printed with %p or %px rather than
>> cast to (unsigned long) and printed with %lx.
>> Change %lx to %pK to print the pointers.
>>
>> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
>> ---
>>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index b5aac862a29..408e5fe710b 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>>  		return VCHIQ_SUCCESS;
>>  
>>  	vchiq_log_trace(vchiq_arm_log_level,
>> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
>> -		__func__, (unsigned long)user_service,
>> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
>> +		__func__, user_service,
>>  		service->localport, user_service->userdata,
>> -		reason, (unsigned long)header,
>> -		(unsigned long)instance, (unsigned long)bulk_userdata);
>> +		reason, header,
>> +		instance, bulk_userdata);
> Why print this out at all?  What uses this?  Can it just be deleted?
>
> thanks,
>
> greg k-h
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
  2021-09-23  5:19   ` Greg KH
  (?)
@ 2021-09-23 12:57     ` Guo Zhi
  -1 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-23 12:57 UTC (permalink / raw)
  To: Greg KH
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

We should restrict kernel pointer leakage issue by using kptr_restrict. 
Therefore kernel pointers should be specified by %pK rather than %lx.

Thanks.

Guo

----- Original Message -----
From: "Greg KH" <gregkh@linuxfoundation.org>
To: "Guo Zhi" <qtxuning1999@sjtu.edu.cn>
Cc: nsaenz@kernel.org, peterz@infradead.org, maz@kernel.org, bsegall@google.com, rdunlap@infradead.org, airlied@redhat.com, "kan liang" <kan.liang@linux.intel.com>, odin@uged.al, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, "linux-kernel" <linux-kernel@vger.kernel.org>
Sent: Thursday, September 23, 2021 1:19:34 PM
Subject: Re: [PATCH] staging: vchip_arm: Fix misuse of %x

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index b5aac862a29..408e5fe710b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>  		return VCHIQ_SUCCESS;
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
> -		__func__, (unsigned long)user_service,
> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
> +		__func__, user_service,
>  		service->localport, user_service->userdata,
> -		reason, (unsigned long)header,
> -		(unsigned long)instance, (unsigned long)bulk_userdata);
> +		reason, header,
> +		instance, bulk_userdata);

Why print this out at all?  What uses this?  Can it just be deleted?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23 12:57     ` Guo Zhi
  0 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-23 12:57 UTC (permalink / raw)
  To: Greg KH
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

We should restrict kernel pointer leakage issue by using kptr_restrict. 
Therefore kernel pointers should be specified by %pK rather than %lx.

Thanks.

Guo

----- Original Message -----
From: "Greg KH" <gregkh@linuxfoundation.org>
To: "Guo Zhi" <qtxuning1999@sjtu.edu.cn>
Cc: nsaenz@kernel.org, peterz@infradead.org, maz@kernel.org, bsegall@google.com, rdunlap@infradead.org, airlied@redhat.com, "kan liang" <kan.liang@linux.intel.com>, odin@uged.al, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, "linux-kernel" <linux-kernel@vger.kernel.org>
Sent: Thursday, September 23, 2021 1:19:34 PM
Subject: Re: [PATCH] staging: vchip_arm: Fix misuse of %x

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index b5aac862a29..408e5fe710b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>  		return VCHIQ_SUCCESS;
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
> -		__func__, (unsigned long)user_service,
> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
> +		__func__, user_service,
>  		service->localport, user_service->userdata,
> -		reason, (unsigned long)header,
> -		(unsigned long)instance, (unsigned long)bulk_userdata);
> +		reason, header,
> +		instance, bulk_userdata);

Why print this out at all?  What uses this?  Can it just be deleted?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23 12:57     ` Guo Zhi
  0 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-23 12:57 UTC (permalink / raw)
  To: Greg KH
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

We should restrict kernel pointer leakage issue by using kptr_restrict. 
Therefore kernel pointers should be specified by %pK rather than %lx.

Thanks.

Guo

----- Original Message -----
From: "Greg KH" <gregkh@linuxfoundation.org>
To: "Guo Zhi" <qtxuning1999@sjtu.edu.cn>
Cc: nsaenz@kernel.org, peterz@infradead.org, maz@kernel.org, bsegall@google.com, rdunlap@infradead.org, airlied@redhat.com, "kan liang" <kan.liang@linux.intel.com>, odin@uged.al, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, "linux-kernel" <linux-kernel@vger.kernel.org>
Sent: Thursday, September 23, 2021 1:19:34 PM
Subject: Re: [PATCH] staging: vchip_arm: Fix misuse of %x

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index b5aac862a29..408e5fe710b 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>  		return VCHIQ_SUCCESS;
>  
>  	vchiq_log_trace(vchiq_arm_log_level,
> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
> -		__func__, (unsigned long)user_service,
> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
> +		__func__, user_service,
>  		service->localport, user_service->userdata,
> -		reason, (unsigned long)header,
> -		(unsigned long)instance, (unsigned long)bulk_userdata);
> +		reason, header,
> +		instance, bulk_userdata);

Why print this out at all?  What uses this?  Can it just be deleted?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
  2021-09-23 12:57     ` Guo Zhi
@ 2021-09-23 13:13       ` Greg KH
  -1 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2021-09-23 13:13 UTC (permalink / raw)
  To: Guo Zhi
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?


http://daringfireball.net/2007/07/on_top

On Thu, Sep 23, 2021 at 08:57:40PM +0800, Guo Zhi wrote:
> We should restrict kernel pointer leakage issue by using kptr_restrict. 
> Therefore kernel pointers should be specified by %pK rather than %lx.

I totally agree.

What I am asking about is why is this message needed at all?  Why not
just remove the whole thing?  Who uses it?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-23 13:13       ` Greg KH
  0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2021-09-23 13:13 UTC (permalink / raw)
  To: Guo Zhi
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?


http://daringfireball.net/2007/07/on_top

On Thu, Sep 23, 2021 at 08:57:40PM +0800, Guo Zhi wrote:
> We should restrict kernel pointer leakage issue by using kptr_restrict. 
> Therefore kernel pointers should be specified by %pK rather than %lx.

I totally agree.

What I am asking about is why is this message needed at all?  Why not
just remove the whole thing?  Who uses it?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
  2021-09-23  5:19   ` Greg KH
@ 2021-09-24  2:57     ` Guo Zhi
  -1 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-24  2:57 UTC (permalink / raw)
  To: Greg KH, nsaenz, peterz, maz, bsegall, rdunlap, airlied,
	kan.liang, odin, phil
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

On 2021/9/23 13:19, Greg KH wrote:
> On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
>> Pointers should be printed with %p or %px rather than
>> cast to (unsigned long) and printed with %lx.
>> Change %lx to %pK to print the pointers.
>>
>> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
>> ---
>>   .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index b5aac862a29..408e5fe710b 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>>   		return VCHIQ_SUCCESS;
>>   
>>   	vchiq_log_trace(vchiq_arm_log_level,
>> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
>> -		__func__, (unsigned long)user_service,
>> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
>> +		__func__, user_service,
>>   		service->localport, user_service->userdata,
>> -		reason, (unsigned long)header,
>> -		(unsigned long)instance, (unsigned long)bulk_userdata);
>> +		reason, header,
>> +		instance, bulk_userdata);
> Why print this out at all?  What uses this?  Can it just be deleted?
>
> thanks,
>
> greg k-h

This information is printed for debugging usage.

But malicious user process can also print it through debugfs at 
/sys/kernel/debug.

As it can be used for debugging, it's a little radical to just delete.

Therefore, I suggest replacing %lx with %pK to avoid kernel address leakage.

thanks,

Guo



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-24  2:57     ` Guo Zhi
  0 siblings, 0 replies; 15+ messages in thread
From: Guo Zhi @ 2021-09-24  2:57 UTC (permalink / raw)
  To: Greg KH, nsaenz, peterz, maz, bsegall, rdunlap, airlied,
	kan.liang, odin, phil
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

On 2021/9/23 13:19, Greg KH wrote:
> On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
>> Pointers should be printed with %p or %px rather than
>> cast to (unsigned long) and printed with %lx.
>> Change %lx to %pK to print the pointers.
>>
>> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
>> ---
>>   .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> index b5aac862a29..408e5fe710b 100644
>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
>> @@ -591,11 +591,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>>   		return VCHIQ_SUCCESS;
>>   
>>   	vchiq_log_trace(vchiq_arm_log_level,
>> -		"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx",
>> -		__func__, (unsigned long)user_service,
>> +		"%s - service %pK(%d,%p), reason %d, header %pK, instance %pK, bulk_userdata %pK",
>> +		__func__, user_service,
>>   		service->localport, user_service->userdata,
>> -		reason, (unsigned long)header,
>> -		(unsigned long)instance, (unsigned long)bulk_userdata);
>> +		reason, header,
>> +		instance, bulk_userdata);
> Why print this out at all?  What uses this?  Can it just be deleted?
>
> thanks,
>
> greg k-h

This information is printed for debugging usage.

But malicious user process can also print it through debugfs at 
/sys/kernel/debug.

As it can be used for debugging, it's a little radical to just delete.

Therefore, I suggest replacing %lx with %pK to avoid kernel address leakage.

thanks,

Guo



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
  2021-09-23  3:55 ` Guo Zhi
@ 2021-09-27 15:35   ` Greg KH
  -1 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2021-09-27 15:35 UTC (permalink / raw)
  To: Guo Zhi
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Does not apply to my tree :(

Please rebase and resend.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] staging: vchip_arm: Fix misuse of %x
@ 2021-09-27 15:35   ` Greg KH
  0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2021-09-27 15:35 UTC (permalink / raw)
  To: Guo Zhi
  Cc: nsaenz, peterz, maz, bsegall, rdunlap, airlied, kan.liang, odin,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-staging, linux-kernel

On Thu, Sep 23, 2021 at 11:55:54AM +0800, Guo Zhi wrote:
> Pointers should be printed with %p or %px rather than
> cast to (unsigned long) and printed with %lx.
> Change %lx to %pK to print the pointers.
> 
> Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Does not apply to my tree :(

Please rebase and resend.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-09-27 15:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23  3:55 [PATCH] staging: vchip_arm: Fix misuse of %x Guo Zhi
2021-09-23  3:55 ` Guo Zhi
2021-09-23  5:19 ` Greg KH
2021-09-23  5:19   ` Greg KH
2021-09-23 10:20   ` Stefan Wahren
2021-09-23 10:20     ` Stefan Wahren
2021-09-23 12:57   ` Guo Zhi
2021-09-23 12:57     ` Guo Zhi
2021-09-23 12:57     ` Guo Zhi
2021-09-23 13:13     ` Greg KH
2021-09-23 13:13       ` Greg KH
2021-09-24  2:57   ` Guo Zhi
2021-09-24  2:57     ` Guo Zhi
2021-09-27 15:35 ` Greg KH
2021-09-27 15:35   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.