linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: He Zhe <zhe.he@windriver.com>
Cc: bp@alien8.de, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mce: Add compat_ioctl assignment to make it compatible with 32-bit system
Date: Mon, 27 Apr 2020 11:19:03 -0700	[thread overview]
Message-ID: <20200427181903.GA14473@agluck-desk2.amr.corp.intel.com> (raw)
In-Reply-To: <1f449e01-3207-b699-b91f-d1c04626a447@windriver.com>

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,
> >  };
> >  
> 

  reply	other threads:[~2020-04-27 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-05-02 14:18     ` He Zhe
     [not found]   ` <59d52031-f4e8-e754-c8b6-ca1130bf0cf1@EyeKnowHow.de>
2021-03-16 17:55     ` EDAC list as Trojan Horse distribution ?? Hermann Ruckerbauer
2021-03-16 18:03       ` Borislav Petkov
     [not found]         ` <3a2cbcf1-388c-4524-907d-0592438320fc@email.android.com>
2021-03-16 19:51           ` Luck, Tony
2021-03-18  8:58             ` Enrico Weigelt, metux IT consult
2021-03-20 19:22       ` Trojan horses on various lists was " Pavel Machek
2020-05-04  8:24 ` [tip: ras/core] x86/mcelog: Add compat_ioctl for 32-bit mcelog support tip-bot2 for He Zhe

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=20200427181903.GA14473@agluck-desk2.amr.corp.intel.com \
    --to=tony.luck@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhe.he@windriver.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).