All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guo Zhi <qtxuning1999@sjtu.edu.cn>
To: Greg KH <gregkh@linuxfoundation.org>,
	nsaenz@kernel.org, peterz@infradead.org, maz@kernel.org,
	bsegall@google.com, rdunlap@infradead.org, airlied@redhat.com,
	kan.liang@linux.intel.com, odin@uged.al, phil@raspberrypi.com
Cc: 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@vger.kernel.org
Subject: Re: [PATCH] staging: vchip_arm: Fix misuse of %x
Date: Fri, 24 Sep 2021 10:57:18 +0800	[thread overview]
Message-ID: <3159c45c-b417-c157-e108-c0e12af2e122@sjtu.edu.cn> (raw)
In-Reply-To: <YUwOZjr06RV2BUi6@kroah.com>

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



WARNING: multiple messages have this Message-ID (diff)
From: Guo Zhi <qtxuning1999@sjtu.edu.cn>
To: Greg KH <gregkh@linuxfoundation.org>,
	nsaenz@kernel.org, peterz@infradead.org, maz@kernel.org,
	bsegall@google.com, rdunlap@infradead.org, airlied@redhat.com,
	kan.liang@linux.intel.com, odin@uged.al, phil@raspberrypi.com
Cc: 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@vger.kernel.org
Subject: Re: [PATCH] staging: vchip_arm: Fix misuse of %x
Date: Fri, 24 Sep 2021 10:57:18 +0800	[thread overview]
Message-ID: <3159c45c-b417-c157-e108-c0e12af2e122@sjtu.edu.cn> (raw)
In-Reply-To: <YUwOZjr06RV2BUi6@kroah.com>

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

  parent reply	other threads:[~2021-09-24  2:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-09-24  2:57     ` Guo Zhi
2021-09-27 15:35 ` Greg KH
2021-09-27 15:35   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3159c45c-b417-c157-e108-c0e12af2e122@sjtu.edu.cn \
    --to=qtxuning1999@sjtu.edu.cn \
    --cc=airlied@redhat.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bsegall@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=nsaenz@kernel.org \
    --cc=odin@uged.al \
    --cc=peterz@infradead.org \
    --cc=phil@raspberrypi.com \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.