From patchwork Thu Jan 25 11:28:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 192025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1574248dyi; Thu, 25 Jan 2024 03:36:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdwkZyiPT54E92kSSJxBS5n96fR+uD8LGji1kqddlGAmdMbukmMapanxUMZr3+iVATCVk/ X-Received: by 2002:a05:6e02:1a48:b0:361:bc55:ab83 with SMTP id u8-20020a056e021a4800b00361bc55ab83mr1044006ilv.16.1706182589392; Thu, 25 Jan 2024 03:36:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706182589; cv=pass; d=google.com; s=arc-20160816; b=axtbzINkGoLIzUbUMbk/iy7uMU1Jj2smm6lTeGItXVjYTfT1CMxC6hRwkEOFzsK3+8 cnLj1EgjQAfcuFsBGisjBPvWYbzRUejalPKy6YB0zmViatuQgU7xKDwzwDK0F/Na8yYv rrWEjf4OxIwTsG+aXJmA9Tn5p8RE7ifrhUFqOneeoUTLsYoXb5bVwOSm9dDUGpftDj9+ fjE1bwztEpRIykKTvzHj+fXqMpdIMi/beAF9Kj5GPXWXQLGrwMNEEop+6lexCOYIAaQ1 qgbKjInYQuk7ghFLpC38hs5vTg/I0vjvu/zmHeCVYDM4AEoxqHKzuZlGOP+EUMJt6Tke taCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=fLLl1bcVbRYtnIzLBeH2xJGti8beoepv/z/uSZlJPHo=; fh=Mjd69IxHltS/Jba8SYEPy4aDMrScq2KBDxG2XjETtWk=; b=tnXCoRchjExohgAoDVeMqYEBRo+wEXgkpnlfkDPDydZMKJe2EilI9XE8Vc/7FES8VJ S7F+rEwsDSyxDJXZeIedMoLSMXBv0nJ/IwIm1vMV99JolTHA97veYX0KSOsqkra2HH6A WcHv8eLlxsoCqQidlkJ9mzH/g6k0efS38hwq9vqCt8T9QRFOweBJZk2CZvDLsHrRsLgq 6PwgjQus5hYkGt4ikPuKzZ6k30rZWnH43vytaglBeY5WdQzF9as9e3mOLo2G32cQvJ0V J3+AgUUL7TT+MVm334wU82hpH4NT6Cu5xWucGfzsd7tyjmPBYwfpdd8v0kj8eHuDkpcj YZvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XQytFWvY; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-38515-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38515-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bw14-20020a056a02048e00b005cde387778esi7715312pgb.368.2024.01.25.03.36.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:36:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38515-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XQytFWvY; arc=pass (i=1 spf=pass spfdomain=flex--ardb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-38515-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38515-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 01BDE28A282 for ; Thu, 25 Jan 2024 11:35:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D909055C0E; Thu, 25 Jan 2024 11:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XQytFWvY" Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A0FC51019 for ; Thu, 25 Jan 2024 11:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182386; cv=none; b=TTS7OO5nVmwjDeTQuBqQ6KITuZ4jK2ScRzosxruiV6JnFia+QlstNuqb0akkb3nexwb8oRwGpSsM/5XNdA5v+5B8TI/3iONXZddZxSHFcuQGMXfT+n+I1dOaLuJz+lyrvSDcH7b1IDEI37IumBxe1/07U6THjJ7OqrcwQlua88A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706182386; c=relaxed/simple; bh=ywQcTtrCDMHJcI+QkXWX2nFyJwoVE8xehI2i+Z3nGsk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=m4cLuWE8vnjuNKUo7UOYMX2+P18kQdMi3PHF2NXE8eVJRdQaOF5uqqfDLJEvtLLy8TQfbeChxFBL6RVBqmuM96eS2fLC76CFxmsuYCvYoJEGW7nsZpn8gH2SBngrl/CJ+H8h11RL0okHJNKVsYrAJaBC52AHJZZIknRSXcvGLTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XQytFWvY; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-40e5f548313so56765455e9.1 for ; Thu, 25 Jan 2024 03:33:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706182383; x=1706787183; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fLLl1bcVbRYtnIzLBeH2xJGti8beoepv/z/uSZlJPHo=; b=XQytFWvYz0bgtEjZlafmrVEl4JEGRW1LWuubtwVLI9igMlHJWWkC1YTeP1FRIfRIAx lucFeZl+VkbkXqEHqmtIfC2zdtOJabRsOMcySxVIGN+SWIgdiMmSzR1DV+BRVBaHM6aL OyKMYAceo2D2x3l7aaGlWtnDOebsXAvRPQaPrGs1Wo2QYQXt5fbBwSjlC92u+ufupZrE MT9Fcz1Svw4NkYbd22PQwyARrrASBQorKidt+F5+IpxYIA1yz3OJRAuHuhJMBU76Z3St s6YLKYzMys6U5ZrHCK7wLb/IgTwzfheETOCp3HI58mbn+MewguaWN5vOkZN9fZ7rKWM6 quYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706182383; x=1706787183; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fLLl1bcVbRYtnIzLBeH2xJGti8beoepv/z/uSZlJPHo=; b=tCW/sSfR2lTWyd5dtdB2PtkinaRxrtzm/kxN6pb402HoHkBHvXI9L6HQ9nnD6ZtwyK tavneyUPXqTGYBi6n6IM7KxqnTwEXlPJMbR1Ik4kgmfdOWCZ1bKTF/1EMWbLvlR1AWgB dygyoxkNyEP1QsEh4IW2ZrvIE1/qrRiTMsdvKfRv1FRxTGACmukcaft1wfuUd6YLZmSo M3XdPgUvb0opFNrHIAbLrEPHeKkZJZOVKwlO/4XmDXDfs1PYC4EWv97ssRPOSytKoTDF zUjTBuccHmg8SVHOmn2p7rkPadOwDkT81RiNQLZqrQjMA2i+9LXtrF3YAqNYVm/uR8xE 2rVQ== X-Gm-Message-State: AOJu0YymLKYUcRO7N7mYUycIRBhApTRXrAyKTYcDQd5zMeR+nF/whtk6 hC6tNoCU0ayvdXpfu8AT57wAmBRDOEk7iBmVGsrRj8cBSefj1toa1MeTu1HGWqR55biOuBvdNd4 jBdsc1PTj4kcKsSHKQJhL3fxGqsX4KFtCv1R/dXDhnmz+ZVdX3cuLJTvgZ2id0ibSr9J1zBC/cl nTZLiTIe3BprugU0g0Y/l6Tzo+uL9RPA== X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:600c:4e0c:b0:40e:c720:f327 with SMTP id b12-20020a05600c4e0c00b0040ec720f327mr14276wmq.4.1706182383051; Thu, 25 Jan 2024 03:33:03 -0800 (PST) Date: Thu, 25 Jan 2024 12:28:30 +0100 In-Reply-To: <20240125112818.2016733-19-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240125112818.2016733-19-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=979; i=ardb@kernel.org; h=from:subject; bh=DDaOUA3J+CFMHhm3e2XXAeDqtyhjkdr8A2J8hJRp8QM=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXWT6wfmH+v9haLvWOZmMFrJXOT6Yz094E3RseZ9K47vm /XtUvaHjlIWBjEOBlkxRRaB2X/f7Tw9UarWeZYszBxWJpAhDFycAjCRpg5Ghm0sH1ScTbRyzT9y LT5+VOxYRanmRG27Jp4J++av9Zuc7sLIsLeAS7395J5HEZYJvUVbV/Nxt13WjZNdJpJ7wl/vXc1 bLgA= X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240125112818.2016733-30-ardb+git@google.com> Subject: [PATCH v2 11/17] modpost: Warn about calls from __pitext into other text sections From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Kevin Loughlin , Tom Lendacky , Dionna Glaze , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Andy Lutomirski , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Justin Stitt , Brian Gerst , linux-arch@vger.kernel.org, llvm@lists.linux.dev X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789062114845909294 X-GMAIL-MSGID: 1789062114845909294 From: Ard Biesheuvel Ensure that code that is marked as being able to safely run from a 1:1 mapping does not call into other code which might lack that property. Signed-off-by: Ard Biesheuvel --- scripts/mod/modpost.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 962d00df47ab..33b56d6b4e7b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -825,6 +825,7 @@ enum mismatch { ANY_INIT_TO_ANY_EXIT, ANY_EXIT_TO_ANY_INIT, EXTABLE_TO_NON_TEXT, + PI_TEXT_TO_NON_PI_TEXT, }; /** @@ -887,6 +888,11 @@ static const struct sectioncheck sectioncheck[] = { .bad_tosec = { ".altinstr_replacement", NULL }, .good_tosec = {ALL_TEXT_SECTIONS , NULL}, .mismatch = EXTABLE_TO_NON_TEXT, +}, +{ + .fromsec = { ALL_PI_TEXT_SECTIONS, NULL }, + .bad_tosec = { ALL_NON_PI_TEXT_SECTIONS, NULL }, + .mismatch = PI_TEXT_TO_NON_PI_TEXT, } };