linux-mips
[Top] [All Lists]

Re: Register allocation in copy_to_user

To: Ralf Baechle <ralf@oss.sgi.com>
Subject: Re: Register allocation in copy_to_user
From: tommy.christensen@eicon.com
Date: Thu, 4 Oct 2001 17:11:45 +0200
Cc: linux-mips@oss.sgi.com
References: <3BB0D217.80E313F5@eicon.com>
Sender: owner-linux-mips@oss.sgi.com
tommy.christensen@eicon.com wrote:
>
> Anyway, the attached patch solves this by explicitly building the
arguments
> to __copy_user in the argument registers ;-) instead of moving them
around.

This idea totally breaks, when the arguments (to copy_to_user) contain a
function call. We force the compiler to use a caller-saved register (like
a0)
across the function call. One place this happens is in net/ipv4/netfilter/
ip_tables.c/copy_entries_to_user().

The patch below fixes this, while preserving the original fix (for the tty
corruption). Although this is getting a little messy, the patch is not as
bad as it might seem. gcc will discard the extra temporary variables
(cu_to,
cu_from and cu_len) in far the most cases, and use them where necessary to
handle function calls.
Sorry, if this has caused any trouble.

-Tommy
(See attached file: uaccess.patch.gz)

Attachment: uaccess.patch.gz
Description: Binary data

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Register allocation in copy_to_user, tommy . christensen <=