All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Dave Martin <Dave.Martin@arm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to 3.12-stable] metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS
Date: Mon, 10 Apr 2017 14:59:12 +0200	[thread overview]
Message-ID: <20170410125930.26495-35-jslaby@suse.cz> (raw)
In-Reply-To: <20170410125930.26495-1-jslaby@suse.cz>

From: Dave Martin <Dave.Martin@arm.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 5fe81fe98123ce41265c65e95d34418d30d005d1 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill TXSTATUS, a well-defined default value is used, based on the
task's current value.

Suggested-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/metag/kernel/ptrace.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c
index ae659ba61948..2e4dfc15abd3 100644
--- a/arch/metag/kernel/ptrace.c
+++ b/arch/metag/kernel/ptrace.c
@@ -24,6 +24,16 @@
  * user_regset definitions.
  */
 
+static unsigned long user_txstatus(const struct pt_regs *regs)
+{
+	unsigned long data = (unsigned long)regs->ctx.Flags;
+
+	if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)
+		data |= USER_GP_REGS_STATUS_CATCH_BIT;
+
+	return data;
+}
+
 int metag_gp_regs_copyout(const struct pt_regs *regs,
 			  unsigned int pos, unsigned int count,
 			  void *kbuf, void __user *ubuf)
@@ -62,9 +72,7 @@ int metag_gp_regs_copyout(const struct pt_regs *regs,
 	if (ret)
 		goto out;
 	/* TXSTATUS */
-	data = (unsigned long)regs->ctx.Flags;
-	if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)
-		data |= USER_GP_REGS_STATUS_CATCH_BIT;
+	data = user_txstatus(regs);
 	ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 				  &data, 4*25, 4*26);
 	if (ret)
@@ -119,6 +127,7 @@ int metag_gp_regs_copyin(struct pt_regs *regs,
 	if (ret)
 		goto out;
 	/* TXSTATUS */
+	data = user_txstatus(regs);
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 &data, 4*25, 4*26);
 	if (ret)
-- 
2.12.2

  parent reply	other threads:[~2017-04-10 12:59 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: iforce - validate number of endpoints before using them Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: ims-pcu " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: hanwang " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: yealink " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: cm109 " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: kbtab " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: qcserial: add Dell DW5811e Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] ACM gadget: fix endianness in notifications Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: uss720: fix NULL-deref at probe Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: idmouse: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: wusbcore: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] usb: hub: Fix crash after failure to read BOS descriptor Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: i1480-dfu: fix NULL-deref at probe Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: hwa-rc: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: ushc: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] ext4: mark inode dirty after converting inline directory Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: sdhci: Do not disable interrupts while waiting for clock Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] nl80211: fix dumpit error path RTNL deadlocks Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] USB: usbtmc: add missing endpoint sanity check Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] xfs: clear _XBF_PAGES from buffers when readahead page Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] block: allow WRITE_SAME commands with the SG_IO ioctl Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] uvcvideo: uvc_scan_fallback() for webcams with broken chain Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] fbcon: Fix vc attr at deinit Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] crypto: algif_hash - avoid zero-sized array Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] virtio_balloon: init 1st buffer in stats vq Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] sparc/ptrace: Preserve previous registers for short regset write Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: " Jiri Slaby
2017-04-10 12:59 ` Jiri Slaby [this message]
2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Reject partial NT_METAG_RPIPE writes Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] sched/rt: Add a missing rescheduling point Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] libceph: force GFP_NOIO for socket allocations Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: mpt3sas: fix hang on ata passthrough commands Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: libsas: fix ata xfer length Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] ALSA: seq: Fix race during FIFO resize Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] ACPI: Fix incompatibility with mcount-based function graph tracing Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA) Jiri Slaby
2017-04-10 13:47   ` Richard Genoud
2017-04-10 15:30     ` Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] USB: fix linked-list corruption in rh_call_control() Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: x86: clear bus pointer when destroyed Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup Jiri Slaby
2017-04-10 13:07   ` Amit Pundir
2017-04-10 13:09     ` Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: fix reading out alarm Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: make sure all members in the output are set Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: implement reset routine as suggested by the reference Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: improve irq handling Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: kvm_io_bus_unregister_dev() should never fail Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] padata: avoid race in reordering Jiri Slaby

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=20170410125930.26495-35-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=Dave.Martin@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.