public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor•com>
To: Florian Westphal <fw@strlen•de>
Cc: linux-fsdevel@vger•kernel.org, Al Viro <viro@zeniv•linux.org.uk>,
	"David S. Miller" <davem@davemloft•net>,
	Thomas Gleixner <tglx@linutronix•de>, Ingo Molnar <mingo@elte•hu>,
	x86@kernel•org, netdev@vger•kernel.org,
	linux-kernel@vger•kernel.org
Subject: Re: [PATCH -next] x86, fs: add sys_compat_write for net/socket.c
Date: Tue, 30 Mar 2010 10:56:05 -0700	[thread overview]
Message-ID: <4BB23B35.7060401@zytor.com> (raw)
In-Reply-To: <1269971469-1254-1-git-send-email-fw@strlen.de>

On 03/30/2010 10:51 AM, Florian Westphal wrote:
> On some configurations, e.g. x86_64 with 32bit userspace, netlink/xfrm
> misinterprets messages from userspace due to different structure
> layout (u64 has different alignment requirements on x86 vs. x86_64).
> 
> As long as messages are sent via sendmsg(), this could be handled via
> net/compat.c; it will set the CMSG_MSG_COMPAT flag in struct msghdr
> for compat tasks, which would allow to the xfrm_user code to detect
> when messages need compat fixups.
> 
> Unfortunately, some programs (e.g. pluto ike daemon), send netlink data
> to the kernel using write().
> 
> Thus, introduce f_ops->compat_aio_write and compat_sys_write to treat
> writes on sockets specially.
> 
> This only wires up compat_sys_write for x86/x86_64 -- at the moment this
> is only required to parse xfrm netlink messages, which happen to only
> need special treatment in case of COMPAT_FOR_U64_ALIGNMENT=y.
> 
> Setting CMSG_MSG_COMPAT depending on plain is_compat_task() in net/socket.c
> was not done due to concerns regarding the kernel doing socket
> writes in response to a user event (which might set MSG_COMPAT erronously).
> 

OK... I have to ask the question:

This only applies if you're using unpacked structures with
non-naturally-aligned objects in them.  Where to we have those, and can
we shoot the authors?

	-hpa

       reply	other threads:[~2010-03-30 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1269971469-1254-1-git-send-email-fw@strlen.de>
2010-03-30 17:56 ` H. Peter Anvin [this message]
2010-03-30 18:17   ` [PATCH -next] x86, fs: add sys_compat_write for net/socket.c Florian Westphal
2010-03-30 18:48     ` Arnd Bergmann

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=4BB23B35.7060401@zytor.com \
    --to=hpa@zytor$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=fw@strlen$(echo .)de \
    --cc=linux-fsdevel@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mingo@elte$(echo .)hu \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=tglx@linutronix$(echo .)de \
    --cc=viro@zeniv$(echo .)linux.org.uk \
    --cc=x86@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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