Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5999510ybe; Tue, 17 Sep 2019 17:47:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO0NGdbxSD2HgXr2NXnYr7dimpGCTFNbLEm19/sFcmCfzantugt3LJNwcyMDgTiZpG+SHQ X-Received: by 2002:a50:bb22:: with SMTP id y31mr7956549ede.58.1568767665496; Tue, 17 Sep 2019 17:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568767665; cv=none; d=google.com; s=arc-20160816; b=WCF1u72Bwuwf5dvnpKWKySEn1VUqxxfeA3qG8XvCqXulFyui+xvQGeKEe77FQSHLCx fT6+8853gCKxLoB2Prniavl+H2zBqj9Uw6C7nQepNvFeG5iDhcd6AriVJudmXGspqdau iF5QepBM3tUxwCDJF7z84jamOihKyqNxTFP+GoGxmrlui8GdRamh/8FWvPi6Ub5vjCha fS16NUq8dymRfG1rGBaLBQlVQ94sWdaCCo7oBFoa+N37WtnzqmRwbZY4UoxBMq1kUMtm QkEz2AJI91juA6+pZjCyBbHSbRgzSQXribKRHokKgsxhT8/hd3aFWbmWZQpw+AubpZaF SlLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yY07VfqUgX4my5EZpAWIwf+BIxT48gqw0QDDJNjm3OE=; b=IyWBakJnslhlm3kJgA83hZhiWgxNyuc7FP7uNewex84FYLecIze3Dgholn2H6SqZKa rVgpEAZm6mSm3yD+FRZLHO0LRopyFq2A9Dfvc+W3Ao0Zg+LEulHBz/U7a9py3spzJjUW 6G4Ps5CEYBc+CjEe7fGBB2etv5Xly3KqSJrgaxe5AtfCzL5dE/tJ0Y3SVCiHUTViYRpK dA8UbT4nYB6jQHb0DDjf5YvN38hNJwt3lL+e+EyEeJOJCQ7KbfT5hsGYaWtq96laAtoH 3hIXoVcmGtOOTavoOADFS2Tq5vvaHD0suQnGgRX+eoLf9Zu1wkuA4MkqSwPMts7Sjhd6 /BYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HaliTMsv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s42si2240798edm.292.2019.09.17.17.47.22; Tue, 17 Sep 2019 17:47:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HaliTMsv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728210AbfIQWoT (ORCPT + 99 others); Tue, 17 Sep 2019 18:44:19 -0400 Received: from mail-vk1-f194.google.com ([209.85.221.194]:34667 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbfIQWoT (ORCPT ); Tue, 17 Sep 2019 18:44:19 -0400 Received: by mail-vk1-f194.google.com with SMTP id d126so1117884vkb.1 for ; Tue, 17 Sep 2019 15:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yY07VfqUgX4my5EZpAWIwf+BIxT48gqw0QDDJNjm3OE=; b=HaliTMsv7+naeIldZcwaeYFI3ASWOOEZ+iVfiE+zXqfOwF2PeRU1PUIAAiOFW8G6ez 138IgTrtwWE7gXmnn5/EgNJRgYNI9CrCX1n/yj5llJwvOEPYmc9hB9z1w3YHTUzHCwVJ VDrwuZCP+zF+4+YGQUXe0+4JzxAZ/m/KVsOkSHiEjrfCl7b+P6ikuQvSLyfTOvoDtZvV /1PR/PX/hMqOlMIUXCbdFUAW+wlCC1vu2SBUR14cJY47dIRiKw3O2jxZtLhdqUlhXTPj msss/IQ5cziXuodxv/npmNRMB42UgEw/PF2a7RONdR0MT33Tb0m9xPikN3dQxStyWsM+ gm/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yY07VfqUgX4my5EZpAWIwf+BIxT48gqw0QDDJNjm3OE=; b=Y052zx2J3gMFPhX4E5ux5jP2IiUZJok55rYUSyhyzsDUPjP1Kuhgq2Z7sawElLSXCw 8qSQIdh178rW1kNjPGBXD9StMbiuUkvtLcHHG93GG8BlMoBoj6Sw2igAOf1Y7ZP3P5uc HEXmy+cbwzxSnOcAST1cZeC9Y3z/uR2/RgUMGHyqU87EJHhB6C3/rGmXTK8e/UyEcdTy JFFVirDXy1ravdAijhLF+v+rV5xVITHTAOJYF015mmyy34f2MRXxX8QPCTbzI8qCmWjY 0OiGzaQWf4tPbMjujem9jeQQGs5WIyLciqLIKGpqGc3vNHFD+XNY+dvGl5SRdyIxRjQU Tx2A== X-Gm-Message-State: APjAAAVD1b0jGdMSsNY3ooDPEVIBaGk/WabQF9NupfOqFWDuekmJg1/X 7dm45rBCPHgOxm0ZXqX848kogJDIdznxV6HOY4NSlg== X-Received: by 2002:a1f:b6ca:: with SMTP id g193mr608323vkf.70.1568760258060; Tue, 17 Sep 2019 15:44:18 -0700 (PDT) MIME-Version: 1.0 References: <20190913210018.125266-1-samitolvanen@google.com> <20190913210018.125266-5-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Tue, 17 Sep 2019 15:44:05 -0700 Message-ID: Subject: Re: [PATCH 4/4] x86: fix function types in COND_SYSCALL To: Andy Lutomirski Cc: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Kees Cook , X86 ML , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 13, 2019 at 5:28 PM Andy Lutomirski wrote= : > Ah, I get it. Doesn=E2=80=99t this cause a little bit of code bloat, thou= gh? A little bit yes, a few extra functions for syscalls that are not otherwise implemented. > What if you made __x86_ni_syscall, etc (possibly using the *DEFINE_SYSCAL= L0 macros) and then generate weak aliases to those? That would be convenient, but COND_SYSCALL is used in kernel/sys_ni.c, and we can't create an alias to a function defined elsewhere: $ cat test.c long b(void); long a(void) __attribute__((alias("b"))); $ gcc -c test.c test.c:2:6: error: =E2=80=98a=E2=80=99 aliased to undefined symbol =E2=80= =98b=E2=80=99 long a(void) __attribute__((alias("b"))); ^ Curiously, when we use inline assembly to create the alias (similarly to the current cond_syscall), gcc just quietly drops the alias if the function is not defined. Sami