Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system
@ 2020-03-04  6:39 zhe.he
  2020-04-16  8:40 ` He Zhe
  0 siblings, 1 reply; 4+ messages in thread
From: zhe.he @ 2020-03-04  6:39 UTC (permalink / raw)
  To: tony.luck, bp, tglx, mingo, hpa, x86, linux-edac, linux-kernel, zhe.he

From: He Zhe <zhe.he@windriver.com>

32-bit user-space program would get errors like the following from ioctl
syscall due to missing compat_ioctl.
MCE_GET_RECORD_LEN: Inappropriate ioctl for device

compat_ptr_ioctl is provided as a generic implementation of .compat_ioctl
file operation to ioctl functions that either ignore the argument or pass
a pointer to a compatible data type.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 arch/x86/kernel/cpu/mce/dev-mcelog.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
index 7c8958d..6c9b91b7 100644
--- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
+++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
@@ -328,6 +328,7 @@ static const struct file_operations mce_chrdev_ops = {
 	.write			= mce_chrdev_write,
 	.poll			= mce_chrdev_poll,
 	.unlocked_ioctl		= mce_chrdev_ioctl,
+	.compat_ioctl		= compat_ptr_ioctl,
 	.llseek			= no_llseek,
 };
 
-- 
2.7.4


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

* Re: [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system
  2020-03-04  6:39 [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system zhe.he
@ 2020-04-16  8:40 ` He Zhe
  2020-04-27 18:19   ` Luck, Tony
  0 siblings, 1 reply; 4+ messages in thread
From: He Zhe @ 2020-04-16  8:40 UTC (permalink / raw)
  To: tony.luck, bp, tglx, mingo, hpa, x86, linux-edac, linux-kernel

Can this be considered for the moment?

Thanks,
Zhe

On 3/4/20 2:39 PM, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>
>
> 32-bit user-space program would get errors like the following from ioctl
> syscall due to missing compat_ioctl.
> MCE_GET_RECORD_LEN: Inappropriate ioctl for device
>
> compat_ptr_ioctl is provided as a generic implementation of .compat_ioctl
> file operation to ioctl functions that either ignore the argument or pass
> a pointer to a compatible data type.
>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  arch/x86/kernel/cpu/mce/dev-mcelog.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
> index 7c8958d..6c9b91b7 100644
> --- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
> +++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
> @@ -328,6 +328,7 @@ static const struct file_operations mce_chrdev_ops = {
>  	.write			= mce_chrdev_write,
>  	.poll			= mce_chrdev_poll,
>  	.unlocked_ioctl		= mce_chrdev_ioctl,
> +	.compat_ioctl		= compat_ptr_ioctl,
>  	.llseek			= no_llseek,
>  };
>  


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

* Re: [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system
  2020-04-16  8:40 ` He Zhe
@ 2020-04-27 18:19   ` Luck, Tony
  2020-05-02 14:18     ` He Zhe
  0 siblings, 1 reply; 4+ messages in thread
From: Luck, Tony @ 2020-04-27 18:19 UTC (permalink / raw)
  To: He Zhe; +Cc: bp, tglx, mingo, hpa, x86, linux-edac, linux-kernel

On Thu, Apr 16, 2020 at 04:40:31PM +0800, He Zhe wrote:
> Can this be considered for the moment?
> 
> Thanks,
> Zhe
> 
> On 3/4/20 2:39 PM, zhe.he@windriver.com wrote:
> > From: He Zhe <zhe.he@windriver.com>
> >
> > 32-bit user-space program would get errors like the following from ioctl
> > syscall due to missing compat_ioctl.
> > MCE_GET_RECORD_LEN: Inappropriate ioctl for device
> >
> > compat_ptr_ioctl is provided as a generic implementation of .compat_ioctl
> > file operation to ioctl functions that either ignore the argument or pass
> > a pointer to a compatible data type.

I'm not super-familiar with the compat ioctl bits.  But this looks plausible.

All three of the ioctl's for this driver have a "pointer to integer" for the
"return" value.  And "int" is a compatible type between i386 and x86_64.

I don't have a system setup to build a 32-bit binary to test the theory,
but I assume that you have built something that tests all three:

	MCE_GET_RECORD_LEN
	MCE_GET_LOG_LEN
	MCE_GETCLEAR_FLAGS

So I guess:

Acked-by: Tony Luck <tony.luck@intel.com>

> >
> > Signed-off-by: He Zhe <zhe.he@windriver.com>
> > ---
> >  arch/x86/kernel/cpu/mce/dev-mcelog.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
> > index 7c8958d..6c9b91b7 100644
> > --- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
> > +++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
> > @@ -328,6 +328,7 @@ static const struct file_operations mce_chrdev_ops = {
> >  	.write			= mce_chrdev_write,
> >  	.poll			= mce_chrdev_poll,
> >  	.unlocked_ioctl		= mce_chrdev_ioctl,
> > +	.compat_ioctl		= compat_ptr_ioctl,
> >  	.llseek			= no_llseek,
> >  };
> >  
> 

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

* Re: [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system
  2020-04-27 18:19   ` Luck, Tony
@ 2020-05-02 14:18     ` He Zhe
  0 siblings, 0 replies; 4+ messages in thread
From: He Zhe @ 2020-05-02 14:18 UTC (permalink / raw)
  To: Luck, Tony; +Cc: bp, tglx, mingo, hpa, x86, linux-edac, linux-kernel



On 4/28/20 2:19 AM, Luck, Tony wrote:
> On Thu, Apr 16, 2020 at 04:40:31PM +0800, He Zhe wrote:
>> Can this be considered for the moment?
>>
>> Thanks,
>> Zhe
>>
>> On 3/4/20 2:39 PM, zhe.he@windriver.com wrote:
>>> From: He Zhe <zhe.he@windriver.com>
>>>
>>> 32-bit user-space program would get errors like the following from ioctl
>>> syscall due to missing compat_ioctl.
>>> MCE_GET_RECORD_LEN: Inappropriate ioctl for device
>>>
>>> compat_ptr_ioctl is provided as a generic implementation of .compat_ioctl
>>> file operation to ioctl functions that either ignore the argument or pass
>>> a pointer to a compatible data type.
> I'm not super-familiar with the compat ioctl bits.  But this looks plausible.
>
> All three of the ioctl's for this driver have a "pointer to integer" for the
> "return" value.  And "int" is a compatible type between i386 and x86_64.
>
> I don't have a system setup to build a 32-bit binary to test the theory,
> but I assume that you have built something that tests all three:
>
> 	MCE_GET_RECORD_LEN
> 	MCE_GET_LOG_LEN
> 	MCE_GETCLEAR_FLAGS
>
> So I guess:
>
> Acked-by: Tony Luck <tony.luck@intel.com>

Thanks, and yes, I had tested all three.

Zhe

>
>>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>>> ---
>>>  arch/x86/kernel/cpu/mce/dev-mcelog.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
>>> index 7c8958d..6c9b91b7 100644
>>> --- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
>>> +++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
>>> @@ -328,6 +328,7 @@ static const struct file_operations mce_chrdev_ops = {
>>>  	.write			= mce_chrdev_write,
>>>  	.poll			= mce_chrdev_poll,
>>>  	.unlocked_ioctl		= mce_chrdev_ioctl,
>>> +	.compat_ioctl		= compat_ptr_ioctl,
>>>  	.llseek			= no_llseek,
>>>  };
>>>  


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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04  6:39 [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system zhe.he
2020-04-16  8:40 ` He Zhe
2020-04-27 18:19   ` Luck, Tony
2020-05-02 14:18     ` He Zhe

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git