Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Paul Barker" <paul@pbarker.dev>
To: "Adarsh Jagadish Kamini" <adarsh.jagadish.kamini@est.tech>,
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] lib/oe/gpg_sign.py: drop unsupported gpg-agent argument passing
Date: Fri, 20 Nov 2026 11:24:01 +0000	[thread overview]
Message-ID: <DN000LWACEB0.1I4HB0QGTWT1X@pbarker.dev> (raw)
In-Reply-To: <20261111140027.69866-1-adarsh.jagadish.kamini@est.tech>

On Wed Nov 11, 2026 at 2:00 PM GMT, Adarsh Jagadish Kamini wrote:
> Passing auto-expand-secmem through --agent-program relies on GnuPG's
> unsupported regression test interface. Remove this use and leave agent
> configuration to the user, since the signing home directory is
> user-managed and an agent may already be running. Users can enable
> auto-expand-secmem in gpg-agent.conf to avoid secure-memory exhaustion
> during parallel signing.
>
> Tested with oe-selftest -r signing.
>
> [YOCTO #16480]
>
> AI-Generated: Uses Kiro (claude-opus-5.5)
> Signed-off-by: Adarsh Jagadish Kamini <adarsh.jagadish.kamini@est.tech>
> ---
>  meta/lib/oe/gpg_sign.py | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
> index ede6186c84..fec6fb27ea 100644
> --- a/meta/lib/oe/gpg_sign.py
> +++ b/meta/lib/oe/gpg_sign.py
> @@ -18,12 +18,7 @@ class LocalSigner(object):
>          self.gpg_bin = d.getVar('GPG_BIN') or \
>                    bb.utils.which(os.getenv('PATH'), 'gpg')
>          self.gpg_cmd = [self.gpg_bin]
> -        self.gpg_agent_bin = bb.utils.which(os.getenv('PATH'), "gpg-agent")
> -        # Without this we see "Cannot allocate memory" errors when running processes in parallel
> -        # It needs to be set for any gpg command since any agent launched can stick around in memory
> -        # and this parameter must be set.
> -        if self.gpg_agent_bin:
> -            self.gpg_cmd += ["--agent-program=%s|--auto-expand-secmem" % (self.gpg_agent_bin)]
> +        # Parallel signing may need auto-expand-secmem in gpg-agent.conf.
>          self.gpg_path = d.getVar('GPG_PATH')
>          self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpmsign")
>          self.gpg_version = self.get_gpg_version()
> @@ -43,7 +38,7 @@ class LocalSigner(object):
>          """Sign RPM files"""
>  
>          cmd = self.rpm_bin + " --addsign --define '_gpg_name %s'  " % keyid
> -        gpg_args = '--no-permission-warning --batch --passphrase=%s --agent-program=%s|--auto-expand-secmem' % (passphrase, self.gpg_agent_bin)
> +        gpg_args = '--no-permission-warning --batch --passphrase=%s' % passphrase
>          if self.gpg_version > (2,1,):
>              gpg_args += ' --pinentry-mode=loopback'
>          cmd += "--define '_gpg_sign_cmd_extra_args %s' " % gpg_args

Hi Adarsh,

I think we need to consider other ways to handle this. Dropping the
argument completely and leaving this up to users risks the user seeing
"Cannot allocate memory" errors without a clear and obvious explanation
of what to do to fix them.

Is there any way to detect if the running gpg-agent has the
auto-expand-secmem option enabled?

If we can't make this safe by default, perhaps we need to use a mutex so
that gpg signing processes run one at a time. If that has a significant
performance impact, we can provide an option to disable the mutex with
instructions on what the user needs to do to enable auto-expand-secmem.

I'm also open to other suggestions on how to handle this.

Thanks,

-- 
Paul Barker


      reply	other threads:[~2026-11-20 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 14:00 [PATCH] lib/oe/gpg_sign.py: drop unsupported gpg-agent argument passing Adarsh Jagadish Kamini
2026-11-20 11:24 ` Paul Barker [this message]

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=DN000LWACEB0.1I4HB0QGTWT1X@pbarker.dev \
    --to=paul@pbarker.dev \
    --cc=adarsh.jagadish.kamini@est.tech \
    --cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox