Message ID | 20210517181424.8093-29-laurent@vivier.eu |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1347190jac; Mon, 17 May 2021 11:45:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzviiTGTXA3UsYxErg8F3U6wO3SjvGNasPu5PhnD4VR5q5hQKmLHZlXsrcm0sMBl3HRXqCe X-Received: by 2002:a6b:b2c8:: with SMTP id b191mr1150474iof.19.1621277101700; Mon, 17 May 2021 11:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621277101; cv=none; d=google.com; s=arc-20160816; b=CNoeomesUXZIe48TAb6945DNyto+i4opXc7TmL5WLmNjNYUiiP7Eh3aTc4Xh2ZSX4O FJ/XlLHByQFpSiJEe2NAHyqs9unbjdFlsnFiHV+zW6FB5vt54N8giieLU8MP8Nk6gH2U cKDBmwouo+uY9xN+Gy+T8mdbHaepmlB9RgS0kBuAbnag+oABNyk7Kdx5T0KO+AkubIWC ONKwg01lOx6It7og6RhGQN6QNxM8Dlc2HmzcWjFMfkghyU1lL5qlAwm+mD2BSWQ7WcGE I8ygn4S2H5STC05GS5vNliskXwDT3WXTFdSJhzy7Z5ISNCRPvLlThU418oPM5exwfxet mFUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=Rlr/DM62R3JCOLmfPXiwLKsg3SOAqgxLEh3i2J9Q6AE=; b=Tx1CHrp8WGy93n3Xm1L0T5GGslcR/2uaorPo6UnElvF/jxjWaNAn3BFo45fYRgAQCv 9NARAHWJJxFo3gq3ePEc0C4KeeuiaBNQA7eIzXHZx8Dg/Xcw8veYvUUhujNHKBhUpAvE dnCL7mcQCQ3gC5qMAoA7fXC261zCFaSyvtRL2YEe3DPpidnawaVgTvgqaK6qEWNDXerJ 26w7B40Y4wccfOL1IZkZEiMNjFpyp3GW9miM0OwmqNXQx5mY7Z6QQhMTNljvq35fAv3m atbN/fTghCRjLR07K6FcMK2H1gmEtyq6Pfn6n0gXh5p4lMeMSbq6Qw2yIU2y7/r5cURj wPxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y10si4326975jak.112.2021.05.17.11.45.01 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 May 2021 11:45:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:44232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1liiEf-0007Xc-3b for patch@linaro.org; Mon, 17 May 2021 14:45:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <laurent@vivier.eu>) id 1lihlc-0006VK-CR for qemu-devel@nongnu.org; Mon, 17 May 2021 14:15:00 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:56575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <laurent@vivier.eu>) id 1lihlN-0004Ru-AC for qemu-devel@nongnu.org; Mon, 17 May 2021 14:15:00 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mf0yy-1lFPLu42FG-00gUtY; Mon, 17 May 2021 20:14:41 +0200 From: Laurent Vivier <laurent@vivier.eu> To: qemu-devel@nongnu.org Subject: [PULL 28/59] linux-user/sparc: Minor corrections to do_sigreturn Date: Mon, 17 May 2021 20:13:53 +0200 Message-Id: <20210517181424.8093-29-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517181424.8093-1-laurent@vivier.eu> References: <20210517181424.8093-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:nW9XUH0vxzB0brOUi4L8KWdVEMBDxPu65thTjLXkGUC9GE4Rp8n AnRjAbC1+oA2+rRqDXiSLUlVUoHBO1ydUo9M+yCu+6Gty9jD85nRN1L+j8c2j0RHBcRHfz1 2K2ksZU3+b21/waOVLLipYEKNojE8N5KGnswK99ZptR1vPW3S6KVgLr161kUwFQfqx+P1tk xEqv29wJHgNQy8+hEuBXw== X-UI-Out-Filterresults: notjunk:1; V03:K0:as3RVSeXN/s=:De88Sl4q4uc+gqkq0b+8R0 ob3zEu6NNLAU63maZv+3bwdFdR8c3inib4FrkNOA8NzVurmR3HRUO4UqEAGLao3BHP7tYGsKD ssYq/PnmaLjAnWME6a1g7O5VVYcduejwTKlciwnh/CM4bmP+/amDSsys7s43pXaXH6UUw4Ro+ VietDsXIccVt7POSukUQ07HbZDcEDSMEem3Jn5zoAFbm6iOzt9sn2HARHtEM1TAn8wdHeWWtD T+IDNS3LJukPmcaXotwk/51ytDTwW9vA5eNxi0wuEZaxZ0P4s0kIsdjGwwvI3JZlOPzKntN7/ PqOUfqrFh++VIkPB6V3+iBCX8xBaJTGfL0yAuHV9wfzPChkipAiNLOCg7yjagrxeAEIsFhbSc mM3/LPMVctTseFWmTxpnUK5Vjau7IGiswPLtmCQy8eYyuNGOTx8sfaoXL1JsY+tLD96Drnl8g LMUnxzRsNZ2/WcBuZVOpgPe4zarBiI+5ITPuCheF0Klvzflc0nVknUM+ooyCqtlZf5pWGAQKR HzDY7EaITdNkSSAKuqexIc= Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Richard Henderson <richard.henderson@linaro.org>, Laurent Vivier <laurent@vivier.eu> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
None
|
expand
|
diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index f0f614a3af7a..0ff57af43d1e 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -254,7 +254,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, long do_sigreturn(CPUSPARCState *env) { abi_ulong sf_addr; - struct target_signal_frame *sf; + struct target_signal_frame *sf = NULL; abi_ulong pc, npc, ptr; target_sigset_t set; sigset_t host_set; @@ -262,18 +262,21 @@ long do_sigreturn(CPUSPARCState *env) sf_addr = env->regwptr[WREG_SP]; trace_user_do_sigreturn(env, sf_addr); - if (!lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { - goto segv_and_exit; - } /* 1. Make sure we are not getting garbage from the user */ + if ((sf_addr & 15) || !lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) { + goto segv_and_exit; + } - if (sf_addr & 3) + /* Make sure stack pointer is aligned. */ + __get_user(ptr, &sf->regs.u_regs[14]); + if (ptr & 7) { goto segv_and_exit; + } - __get_user(pc, &sf->regs.pc); + /* Make sure instruction pointers are aligned. */ + __get_user(pc, &sf->regs.pc); __get_user(npc, &sf->regs.npc); - if ((pc | npc) & 3) { goto segv_and_exit; } @@ -309,7 +312,7 @@ long do_sigreturn(CPUSPARCState *env) unlock_user_struct(sf, sf_addr, 0); return -TARGET_QEMU_ESIGRETURN; -segv_and_exit: + segv_and_exit: unlock_user_struct(sf, sf_addr, 0); force_sig(TARGET_SIGSEGV); return -TARGET_QEMU_ESIGRETURN;