From patchwork Thu Feb 25 11:01:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 8422521 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CDFC9C0553 for ; Thu, 25 Feb 2016 11:05:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82BBD202B8 for ; Thu, 25 Feb 2016 11:05:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB1D7202AE for ; Thu, 25 Feb 2016 11:05:06 +0000 (UTC) Received: from localhost ([::1]:42175 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYtjG-0002BZ-5p for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Feb 2016 06:05:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYtfq-0005FL-Jo for qemu-devel@nongnu.org; Thu, 25 Feb 2016 06:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYtfk-0000dd-TK for qemu-devel@nongnu.org; Thu, 25 Feb 2016 06:01:34 -0500 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:34556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYtfk-0000dX-Ly for qemu-devel@nongnu.org; Thu, 25 Feb 2016 06:01:28 -0500 Received: by mail-lf0-x233.google.com with SMTP id j78so30548145lfb.1 for ; Thu, 25 Feb 2016 03:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=J8ROv14kGYcsR757MNlg6wBLd0I6/S8zfHUKmc+hPSc=; b=ggdxuMSJR7YhGJSQ0d8EwFcReWJicNu+e3Pkk/3HbNWv+kR/aeIZmP+zia+ifTDVtL DLrVh9P1PQYC0aAbBv1fh4IbmT6S7bSOcpttR+3NcAGooEA80Athj1OTANq+j5UDR8Zu dnmb9WBEINzW/4I9qZ9XyojiRLhXf+7qWcq5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=J8ROv14kGYcsR757MNlg6wBLd0I6/S8zfHUKmc+hPSc=; b=h10RUPfV5sWD+hGEc8qzGIHUhjI0LmoKTjsSvEuLs3EpQrzpLXYrjwOwhSQ3eFoSKN hlswYoHg06/dvVrwNw6Vi1VVD5Tt6oghnukecS3ljkKW8Hd1f3+X0cJOws62Mp9hkZKk HAZI5aDQfX7riKn7GlqMHRw9RqRRN3im6WFVCnYqw7NfhP2+FJLXGOFaSnwuXETgCSt0 WSx5dm4EvcwVAt1Ob2k3rMCKp9RZ2LJOrI7UXbjmS25xJDSORjyUdXvVB0GHWT1kGdeY PyMjo6q+aIJ4WJnUZrEE4gmAcHD+/kQmLYJV8rv6xDMTMIckk/vr2HbY35EtYmykSCen M3Ew== X-Gm-Message-State: AG10YOSo3g42ul+6waom6kuN9uWVDbqwLazPo2V+VwlmIcrshvra49Kv8X2/gEZlc2LnNkBd X-Received: by 10.25.165.133 with SMTP id o127mr16343942lfe.105.1456398087839; Thu, 25 Feb 2016 03:01:27 -0800 (PST) Received: from beaming.home (91-157-175-207.elisa-laajakaista.fi. [91.157.175.207]) by smtp.gmail.com with ESMTPSA id f184sm1066803lfe.6.2016.02.25.03.01.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Feb 2016 03:01:26 -0800 (PST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 25 Feb 2016 13:01:13 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::233 Cc: Laurent Vivier Subject: [Qemu-devel] [PULL v2 8/8] linux-user: add getrandom() syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Vivier getrandom() has been introduced in kernel 3.17 and is now used during the boot sequence of Debian unstable (stretch/sid). Signed-off-by: Laurent Vivier Signed-off-by: Riku Voipio --- linux-user/syscall.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 539183a..9517531 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -249,6 +249,9 @@ _syscall2(int, ioprio_get, int, which, int, who) #if defined(TARGET_NR_ioprio_set) && defined(__NR_ioprio_set) _syscall3(int, ioprio_set, int, which, int, who, int, ioprio) #endif +#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom) +_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags) +#endif static bitmask_transtbl fcntl_flags_tbl[] = { { TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, }, @@ -7541,6 +7544,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ret = get_errno(shutdown(arg1, arg2)); break; #endif +#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom) + case TARGET_NR_getrandom: + p = lock_user(VERIFY_WRITE, arg1, arg2, 0); + if (!p) { + goto efault; + } + ret = get_errno(getrandom(p, arg2, arg3)); + unlock_user(p, arg1, ret); + break; +#endif #ifdef TARGET_NR_socket case TARGET_NR_socket: ret = do_socket(arg1, arg2, arg3);