!66 backport upstream patches

From: @markeryang 
Reviewed-by: @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
This commit is contained in:
openeuler-ci-bot 2024-03-27 02:39:27 +00:00 committed by Gitee
commit 3175c9b573
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From ee20d385ef319f8523f1debc49f375c8eff257a6 Mon Sep 17 00:00:00 2001
From: "Andrew G. Morgan" <morgan@kernel.org>
Date: Fri, 22 Dec 2023 06:37:02 -0800
Subject: Stop using _pam_overwrite() in pam_cap.c.
It looks like the Linux-PAM folk have deprecated this macro. Compiler optimization
is hard to account for: apparently this explicit deletion is no longer
guaranteed to work. This function was marked deprecated in v1.5.3 of Linux-PAM.
I've replaced its use with memset(). I'm not convinced that that will be honored
either, but remain hopeful and prefer to leave the code explicit in its intent
without a deprecation warning messing up the build log. Should some compiler
optimize it away and it leads to an exploit of some sort, it can be revealed as
a compilation bug.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
---
pam_cap/pam_cap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pam_cap/pam_cap.c b/pam_cap/pam_cap.c
index b9419cb..3fe3b8c 100644
--- a/pam_cap/pam_cap.c
+++ b/pam_cap/pam_cap.c
@@ -199,7 +199,7 @@ defer:
int i;
for (i = 0; i < groups_n; i++) {
char *g = groups[i];
- _pam_overwrite(g);
+ memset(g, 0, strlen(g));
_pam_drop(g);
}
if (groups != NULL) {
@@ -440,7 +440,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
small race associated with a redundant read of the
config. */
- _pam_overwrite(conf_caps);
+ memset(conf_caps, 0, strlen(conf_caps));
_pam_drop(conf_caps);
return PAM_SUCCESS;
--
cgit 1.2.3-korg

View File

@ -0,0 +1,27 @@
From 17c5e89521fd0455a8f18563eb37e5ddbc7d34cb Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@jwilk.net>
Date: Mon, 29 Jan 2024 11:33:40 +0100
Subject: getpcaps: fix program name in help message
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
---
progs/getpcaps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/progs/getpcaps.c b/progs/getpcaps.c
index 7e14c36..b4cbda8 100644
--- a/progs/getpcaps.c
+++ b/progs/getpcaps.c
@@ -14,7 +14,7 @@
static void usage(int code)
{
fprintf(stderr,
-"usage: getcaps [opts] <pid> [<pid> ...]\n\n"
+"usage: getpcaps [opts] <pid> [<pid> ...]\n\n"
" This program displays the capabilities on the queried process(es).\n"
" The capabilities are displayed in the cap_from_text(3) format.\n"
"\n"
--
cgit 1.2.3-korg

View File

@ -1,6 +1,6 @@
Name: libcap
Version: 2.69
Release: 2
Release: 3
Summary: A library for getting and setting POSIX.1e draft 15 capabilities
License: GPLv2
URL: https://sites.google.com/site/fullycapable
@ -9,6 +9,8 @@ Source0: https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/%{n
Patch0: libcap-buildflags.patch
Patch1: backport-libcap-Ensure-the-XATTR_NAME_CAPS-is-define.patch
Patch2: support-specify-cc.patch
Patch3: backport-getpcaps-fix-program-name-in-help-message.patch
Patch4: backport-Stop-using-_pam_overwrite-in-pam_cap.c.patch
BuildRequires: libattr-devel pam-devel perl-interpreter gcc
@ -71,6 +73,12 @@ chmod +x %{buildroot}/%{_libdir}/*.so.*
%{_mandir}/man8/*.gz
%changelog
* Wed Mar 27 2024 yanglongkang <yanglongkang@h-partners.com> - 2.69-3
- backport upstream patches:
getpcaps: fix program name in help message
Stop using _pam_overwrite() in pam_cap.c
* Sun Apr 16 2023 jammyjellyfish <jammyjellyfish255@outlook.com> - 2.69-2
- Support specify CC