linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jamie@shareable.org (Jamie Lokier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Add SWP/SWPB emulation for ARMv7 processors
Date: Thu, 17 Dec 2009 19:32:10 +0000	[thread overview]
Message-ID: <20091217193210.GD362@shareable.org> (raw)
In-Reply-To: <20091217175416.9317.66257.stgit@e101986-lin>

Leif Lindholm wrote:
> To correctly deal with copy-on-write, it also modifies
> cpu_v7_set_pte_ext to change the mappings to priviliged RO when user RO.

Does this break ptrace writing to RO pages or anything else?
If it doesn't break anything, seems to me it should always be done
like that, not conditional on CONFIG_SWP_EMULATE.

> +static void set_segfault(struct pt_regs *regs)
> +{
> +	siginfo_t info;
> +
> +	info.si_signo = SIGSEGV;
> +	info.si_errno = 0;
> +	info.si_code  = SEGV_ACCERR;
> +	info.si_addr  = (void __user *)regs->ARM_pc;

Ideally it would report the same errors as userspace accesses, as
calculated in do_page_fault() and passed to __do_user_fault(), for the
benefit of programs which distinguish SEGV_MAPERR from SEGV_ACCERR.

> +	printk(KERN_INFO "SWP{B} emulation: access caused memory abort!\n");
> +	arm_notify_die("Illegal memory access", regs, &info, 0, 0);

> +	if (address & 0x3) {
> +		/* SWP to unaligned address not permitted */
> +		printk(KERN_INFO "SWP instruction on unaligned pointer!\n");
> +		return -EFAULT;
> +	}

These printks look like an easy local denial of service.  They should
be rate limited.

-- Jamie

  parent reply	other threads:[~2009-12-17 19:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17 17:54 [PATCH] ARM: Add SWP/SWPB emulation for ARMv7 processors Leif Lindholm
2009-12-17 18:19 ` Woodruff, Richard
2009-12-17 19:16   ` Jamie Lokier
2009-12-17 20:43     ` Woodruff, Richard
2009-12-18 20:31       ` Jamie Lokier
2010-01-08 23:20         ` Woodruff, Richard
2009-12-18 14:15   ` Leif Lindholm
2009-12-17 19:32 ` Jamie Lokier [this message]
2009-12-18 10:00   ` Catalin Marinas
2009-12-18 10:06   ` Catalin Marinas
2009-12-18 17:01   ` Leif Lindholm

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=20091217193210.GD362@shareable.org \
    --to=jamie@shareable.org \
    --cc=linux-arm-kernel@lists.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 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).