* [PATCH] lib/oe/gpg_sign.py: drop unsupported gpg-agent argument passing
@ 2026-11-11 14:00 Adarsh Jagadish Kamini
2026-11-20 11:24 ` Paul Barker
0 siblings, 1 reply; 2+ messages in thread
From: Adarsh Jagadish Kamini @ 2026-11-11 14:00 UTC (permalink / raw)
To: openembedded-core
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] lib/oe/gpg_sign.py: drop unsupported gpg-agent argument passing
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
0 siblings, 0 replies; 2+ messages in thread
From: Paul Barker @ 2026-11-20 11:24 UTC (permalink / raw)
To: Adarsh Jagadish Kamini, openembedded-core
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.