Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
Fedora Release Engineering
7248db7686 dist-git conversion 2010-07-29 14:50:15 +00:00
Bill Nottingham
e336b5784d Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:16:36 +00:00
kzak
0e29548e09 - fix #454252 - Problem with who,write and tty permissions
- fix #449738 - Wakeup on RTC alarm does not work anymore [rebase to
    rtcwake(8) from util-linux-ng 2.14.1]
- fix #454354 - FAT filesystem mount option utf8=0 is not documented
2008-08-12 14:03:21 +00:00
kzak
05c92a9c3f - fix #443823 - ionice.1 doesn't to reflect idle class changes in 2.6.25 2008-04-28 10:40:39 +00:00
kzak
a38a974603 - fix audit log injection attack via login 2008-04-22 19:38:16 +00:00
Jesse Keating
9023504857 Initialize branch F-9 for util-linux-ng 2008-04-22 00:17:59 +00:00
8 changed files with 509 additions and 22 deletions

View file

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: util-linux-ng
# $Id$
NAME := util-linux-ng
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -0,0 +1,17 @@
diff -up util-linux-ng-2.13.1/mount/mount.8.kzak util-linux-ng-2.13.1/mount/mount.8
--- util-linux-ng-2.13.1/mount/mount.8.kzak 2008-08-12 15:34:29.000000000 +0200
+++ util-linux-ng-2.13.1/mount/mount.8 2008-08-12 15:34:32.000000000 +0200
@@ -1729,9 +1729,10 @@ before trying
.IR name~num.ext .
.TP
.B utf8
-UTF8 is the filesystem safe 8-bit encoding of Unicode that is used
-by the console. It can be be enabled for the filesystem with this option.
-If `uni_xlate' gets set, UTF8 gets disabled.
+UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the
+console. It can be be enabled for the filesystem with this option or disabled
+with utf8=0, utf8=no or utf8=false. If `uni_xlate' gets set, UTF8 gets
+disabled.
.TP
.B shortname=[lower|win95|winnt|mixed]

301
rtcwake-rebase-2.14.1.patch Normal file
View file

@ -0,0 +1,301 @@
diff -up util-linux-ng-2.13.1/sys-utils/rtcwake.8.kzak util-linux-ng-2.13.1/sys-utils/rtcwake.8
--- util-linux-ng-2.13.1/sys-utils/rtcwake.8.kzak 2008-08-12 15:26:02.000000000 +0200
+++ util-linux-ng-2.13.1/sys-utils/rtcwake.8 2008-08-12 15:26:02.000000000 +0200
@@ -76,15 +76,20 @@ is the time in seconds since 1970-01-01,
Use standby state \fImode\fP. Valid values are \fIstandby\fP,
\fImem\fP, \fIdisk\fP and \fIon\fP (no suspend). The default is
\fIstandby\fP.
+.SH NOTES
+Some PC systems can't currently exit sleep states such as \fImem\fP
+using only the kernel code accessed by this driver.
+They need help from userspace code to make the framebuffer work again.
.SH HISTORY
-The program first appeared as kernel commit message for Linux 2.6 in the GIT
+The program was posted several times on LKML and other lists
+before appearing in kernel commit message for Linux 2.6 in the GIT
commit 87ac84f42a7a580d0dd72ae31d6a5eb4bfe04c6d.
.SH AVAILABILITY
The rtcwake command is part of the util-linux-ng package and is available from
ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
.SH AUTHOR
-The program was written by David Brownell <david-b@pacbell.net> and improved by
-Bernhard Walle <bwalle@suse.de>.
+The program was written by David Brownell <dbrownell@users.sourceforge.net>
+and improved by Bernhard Walle <bwalle@suse.de>.
.SH COPYRIGHT
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
diff -up util-linux-ng-2.13.1/sys-utils/rtcwake.c.kzak util-linux-ng-2.13.1/sys-utils/rtcwake.c
--- util-linux-ng-2.13.1/sys-utils/rtcwake.c.kzak 2008-08-12 15:17:56.000000000 +0200
+++ util-linux-ng-2.13.1/sys-utils/rtcwake.c 2008-08-12 15:25:35.000000000 +0200
@@ -16,11 +16,13 @@
* The best way to set the system's RTC is so that it holds the current
* time in UTC. Use the "-l" flag to tell this program that the system
* RTC uses a local timezone instead (maybe you dual-boot MS-Windows).
+ * That flag should not be needed on systems with adjtime support.
*/
#include <stdio.h>
#include <getopt.h>
#include <fcntl.h>
+#include <libgen.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -46,10 +48,10 @@ static char *progname;
#define VERSION_STRING "rtcwake from " PACKAGE_STRING
#define RTC_PATH "/sys/class/rtc/%s/device/power/wakeup"
-#define SYS_POWER_SATE_PATH "/sys/power/state"
+#define SYS_POWER_STATE_PATH "/sys/power/state"
#define ADJTIME_PATH "/etc/adjtime"
#define DEFAULT_DEVICE "/dev/rtc0"
-#define DEFAULT_MODE "suspend"
+#define DEFAULT_MODE "standby"
enum ClockMode {
CM_AUTO,
@@ -89,7 +91,7 @@ static void usage(int retval)
exit(retval);
}
-static int may_wakeup(const char *devname)
+static int is_wakeup_enabled(const char *devname)
{
char buf[128], *s;
FILE *f;
@@ -136,12 +138,12 @@ static int get_basetimes(int fd)
*/
if (ioctl(fd, RTC_RD_TIME, &rtc) < 0) {
perror(_("read rtc time"));
- return 0;
+ return -1;
}
sys_time = time(0);
if (sys_time == (time_t)-1) {
perror(_("read system time"));
- return 0;
+ return -1;
}
/* convert rtc_time to normal arithmetic-friendly form,
@@ -159,22 +161,26 @@ static int get_basetimes(int fd)
if (rtc_time == (time_t)-1) {
perror(_("convert rtc time"));
- return 0;
+ return -1;
}
if (verbose) {
- if (clock_mode == CM_LOCAL) {
- printf("\ttzone = %ld\n", timezone);
- printf("\ttzname = %s\n", tzname[daylight]);
- gmtime_r(&rtc_time, &tm);
- }
- printf("\tsystime = %ld, (UTC) %s\n",
+ /* Unless the system uses UTC, either delta or tzone
+ * reflects a seconds offset from UTC. The value can
+ * help sort out problems like bugs in your C library.
+ */
+ printf("\tdelta = %ld\n", sys_time - rtc_time);
+ printf("\ttzone = %ld\n", timezone);
+
+ printf("\ttzname = %s\n", tzname[daylight]);
+ gmtime_r(&rtc_time, &tm);
+ printf("\tsystime = %ld, (UTC) %s",
(long) sys_time, asctime(gmtime(&sys_time)));
- printf("\trtctime = %ld, (UTC) %s\n",
+ printf("\trtctime = %ld, (UTC) %s",
(long) rtc_time, asctime(&tm));
}
- return 1;
+ return 0;
}
static int setup_alarm(int fd, time_t *wakeup)
@@ -182,7 +188,17 @@ static int setup_alarm(int fd, time_t *w
struct tm *tm;
struct rtc_wkalrm wake;
- tm = gmtime(wakeup);
+ /* The wakeup time is in POSIX time (more or less UTC).
+ * Ideally RTCs use that same time; but PCs can't do that
+ * if they need to boot MS-Windows. Messy...
+ *
+ * When clock_mode == CM_UTC this process's timezone is UTC,
+ * so we'll pass a UTC date to the RTC.
+ *
+ * Else clock_mode == CM_LOCAL so the time given to the RTC
+ * will instead use the local time zone.
+ */
+ tm = localtime(wakeup);
wake.time.tm_sec = tm->tm_sec;
wake.time.tm_min = tm->tm_min;
@@ -190,41 +206,41 @@ static int setup_alarm(int fd, time_t *w
wake.time.tm_mday = tm->tm_mday;
wake.time.tm_mon = tm->tm_mon;
wake.time.tm_year = tm->tm_year;
- wake.time.tm_wday = tm->tm_wday;
- wake.time.tm_yday = tm->tm_yday;
- wake.time.tm_isdst = tm->tm_isdst;
-
- /* many rtc alarms only support up to 24 hours from 'now' ... */
- if ((rtc_time + (24 * 60 * 60)) > *wakeup) {
- if (ioctl(fd, RTC_ALM_SET, &wake.time) < 0) {
- perror(_("set rtc alarm"));
- return 0;
- }
- if (ioctl(fd, RTC_AIE_ON, 0) < 0) {
- perror(_("enable rtc alarm"));
- return 0;
- }
-
- /* ... so use the "more than 24 hours" request only if we must */
- } else {
- /* avoid an extra AIE_ON call */
- wake.enabled = 1;
-
- if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) {
+ /* wday, yday, and isdst fields are unused by Linux */
+ wake.time.tm_wday = -1;
+ wake.time.tm_yday = -1;
+ wake.time.tm_isdst = -1;
+
+ wake.enabled = 1;
+ /* First try the preferred RTC_WKALM_SET */
+ if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) {
+ wake.enabled = 0;
+ /* Fall back on the non-preferred way of setting wakeups; only
+ * works for alarms < 24 hours from now */
+ if ((rtc_time + (24 * 60 * 60)) > *wakeup) {
+ if (ioctl(fd, RTC_ALM_SET, &wake.time) < 0) {
+ perror(_("set rtc alarm"));
+ return -1;
+ }
+ if (ioctl(fd, RTC_AIE_ON, 0) < 0) {
+ perror(_("enable rtc alarm"));
+ return -1;
+ }
+ } else {
perror(_("set rtc wake alarm"));
- return 0;
+ return -1;
}
}
- return 1;
+ return 0;
}
static void suspend_system(const char *suspend)
{
- FILE *f = fopen(SYS_POWER_SATE_PATH, "w");
+ FILE *f = fopen(SYS_POWER_STATE_PATH, "w");
if (!f) {
- perror(SYS_POWER_SATE_PATH);
+ perror(SYS_POWER_STATE_PATH);
return;
}
@@ -243,24 +259,24 @@ static int read_clock_mode(void)
fp = fopen(ADJTIME_PATH, "r");
if (!fp)
- return 0;
+ return -1;
/* skip first line */
if (!fgets(linebuf, MAX_LINE, fp)) {
fclose(fp);
- return 0;
+ return -1;
}
/* skip second line */
if (!fgets(linebuf, MAX_LINE, fp)) {
fclose(fp);
- return 0;
+ return -1;
}
/* read third line */
if (!fgets(linebuf, MAX_LINE, fp)) {
fclose(fp);
- return 0;
+ return -1;
}
if (strncmp(linebuf, "UTC", 3) == 0)
@@ -270,7 +286,7 @@ static int read_clock_mode(void)
fclose(fp);
- return 1;
+ return 0;
}
int main(int argc, char **argv)
@@ -321,8 +337,9 @@ int main(int argc, char **argv)
suspend = strdup(optarg);
break;
}
- fprintf(stderr, _("%s: unrecognized suspend state '%s'\n"),
- progname, optarg);
+ fprintf(stderr,
+ _("%s: unrecognized suspend state '%s'\n"),
+ progname, optarg);
usage(EXIT_FAILURE);
/* alarm time, seconds-to-sleep (relative) */
@@ -372,14 +389,14 @@ int main(int argc, char **argv)
}
if (clock_mode == CM_AUTO) {
- if (!read_clock_mode()) {
+ if (read_clock_mode() < 0) {
printf(_("%s: assuming RTC uses UTC ...\n"), progname);
clock_mode = CM_UTC;
}
- if (verbose)
- printf(_("Using %s time\n"),
- clock_mode == CM_UTC ? "UTC" : _("local"));
}
+ if (verbose)
+ printf(clock_mode == CM_UTC ? _("Using UTC time.\n") :
+ _("Using local time.\n"));
if (!alarm && !seconds) {
fprintf(stderr, _("%s: must provide wake time\n"), progname);
@@ -402,7 +419,7 @@ int main(int argc, char **argv)
devname = new_devname;
}
- if (strcmp(suspend, "on") != 0 && !may_wakeup(devname)) {
+ if (strcmp(suspend, "on") != 0 && !is_wakeup_enabled(devname)) {
fprintf(stderr, _("%s: %s not enabled for wakeup events\n"),
progname, devname);
exit(EXIT_FAILURE);
@@ -416,15 +433,16 @@ int main(int argc, char **argv)
}
/* relative or absolute alarm time, normalized to time_t */
- if (!get_basetimes(fd))
+ if (get_basetimes(fd) < 0)
exit(EXIT_FAILURE);
if (verbose)
printf(_("alarm %ld, sys_time %ld, rtc_time %ld, seconds %u\n"),
alarm, sys_time, rtc_time, seconds);
if (alarm) {
if (alarm < sys_time) {
- fprintf(stderr, _("%s: time doesn't go backward to %s\n"),
- progname, ctime(&alarm));
+ fprintf(stderr,
+ _("%s: time doesn't go backward to %s\n"),
+ progname, ctime(&alarm));
exit(EXIT_FAILURE);
}
alarm += sys_time - rtc_time;

View file

@ -0,0 +1,33 @@
From 776452cbfcfc2dfe81088e29ae13a681bee64e75 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 28 Apr 2008 12:23:40 +0200
Subject: [PATCH] ionice: update man page to reflect IDLE class change in 2.6.25
The idle class is safe for non-root users since 2.6.25.
http://lwn.net/Articles/266256/
Addresses-Red-Hat-Bugzilla: #443823
Signed-off-by: Karel Zak <kzak@redhat.com>
---
schedutils/ionice.1 | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/schedutils/ionice.1 b/schedutils/ionice.1
index 8203a5e..93aabe8 100644
--- a/schedutils/ionice.1
+++ b/schedutils/ionice.1
@@ -13,8 +13,9 @@ this writing, Linux supports 3 scheduling classes:
A program running with idle io priority will only get disk time when no other
program has asked for disk io for a defined grace period. The impact of idle
io processes on normal system activity should be zero. This scheduling
-class does not take a priority argument. This scheduling class is not
-permitted for an ordinary (i.e., non-root) user.
+class does not take a priority argument. Presently, this scheduling class
+is permitted for an ordinary user (since kernel 2.6.25).
+
\fBBest effort\fR.
This is the default scheduling class for any process that hasn't asked for
--
1.5.4.1

View file

@ -0,0 +1,51 @@
From 8ccf0b253ac0f4f58d64bc9674de18bff5a88782 Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Sat, 19 Apr 2008 11:49:02 -0400
Subject: [PATCH] login: audit log injection attack via login
A while back I found a couple audit log injection attacks which became
CVE-2007-3102. I forgot to look at login to see if its vulnerable and Mirek
found that it is. To verify the problem, type:
root addr=xyz.com
for the account name while logging in. It will look like root logged in with
an address of xyz.com.
Signed-off-by: Steve Grubb <sgrubb@redhat.com>
---
login-utils/login.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/login-utils/login.c b/login-utils/login.c
index aad2779..2301213 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -324,7 +324,6 @@ static void
logaudit(const char *tty, const char *username, const char *hostname,
struct passwd *pwd, int status)
{
- char buf[64];
int audit_fd;
audit_fd = audit_open();
@@ -332,13 +331,10 @@ logaudit(const char *tty, const char *username, const char *hostname,
return;
if (!pwd && username)
pwd = getpwnam(username);
- if (pwd)
- snprintf(buf, sizeof(buf), "uid=%d", pwd->pw_uid);
- else
- snprintf(buf, sizeof(buf), "acct=%s", username ? username : "(unknown)");
- audit_log_user_message(audit_fd, AUDIT_USER_LOGIN,
- buf, hostname, NULL, tty, status);
+ audit_log_acct_message(audit_fd, AUDIT_USER_LOGIN,
+ NULL, "login", username ? username : "(unknown)",
+ pwd ? pwd->pw_uid : -1, hostname, NULL, tty, status);
close(audit_fd);
}
--
1.5.4.1

View file

@ -2,7 +2,7 @@
Summary: A collection of basic system utilities Summary: A collection of basic system utilities
Name: util-linux-ng Name: util-linux-ng
Version: 2.13.1 Version: 2.13.1
Release: 8%{?dist} Release: 8.3%{?dist}
License: GPLv2 and GPLv2+ and BSD with advertising and Public Domain License: GPLv2 and GPLv2+ and BSD with advertising and Public Domain
Group: System Environment/Base Group: System Environment/Base
URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng
@ -106,6 +106,17 @@ Patch11: util-linux-ng-2.13-floppy-locale.patch
Patch12: util-linux-ng-2.13-blockdev-rmpart.patch Patch12: util-linux-ng-2.13-blockdev-rmpart.patch
# 439984 - backport mkswap -U # 439984 - backport mkswap -U
Patch13: util-linux-ng-2.13-mkswap-uuid.patch Patch13: util-linux-ng-2.13-mkswap-uuid.patch
# CVE-2007-3102
Patch14: util-linux-ng-2.13-login-audit.patch
# 443823 - ionice.1 doesn't to reflect idle class changes in 2.6.25
Patch15: util-linux-ng-2.13-ionice-man-idle.patch
# 454252 - Problem with who,write and tty permissions (upstream patch)
Patch16: write-doesn-t-check-for-tty-group.patch
# 449738 - Wakeup on RTC alarm does not work anymore
# [rebase to rtcwake(8) from util-linux-ng 2.14.1]
Patch17: rtcwake-rebase-2.14.1.patch
# 454354 - FAT filesystem mount option utf8=0 is not documented
Patch18: mount-add-docs-about-utf8-0-for-vfat.patch
%description %description
The util-linux-ng package contains a large variety of low-level system The util-linux-ng package contains a large variety of low-level system
@ -131,6 +142,11 @@ cp %{SOURCE8} %{SOURCE9} .
%patch11 -p1 %patch11 -p1
%patch12 -p1 %patch12 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%build %build
unset LINGUAS || : unset LINGUAS || :
@ -524,6 +540,18 @@ exit 0
/sbin/losetup /sbin/losetup
%changelog %changelog
* Tue Aug 12 2008 Karel Zak <kzak@redhat.com> 2.13.1-8.3
- fix #454252 - Problem with who,write and tty permissions
- fix #449738 - Wakeup on RTC alarm does not work anymore
[rebase to rtcwake(8) from util-linux-ng 2.14.1]
- fix #454354 - FAT filesystem mount option utf8=0 is not documented
* Mon Apr 28 2008 Karel Zak <kzak@redhat.com> 2.13.1-8.2
- fix #443823 - ionice.1 doesn't to reflect idle class changes in 2.6.25
* Tue Apr 22 2008 Karel Zak <kzak@redhat.com> 2.13.1-8.1
- fix audit log injection attack via login
* Thu Apr 17 2008 Karel Zak <kzak@redhat.com> 2.13.1-8 * Thu Apr 17 2008 Karel Zak <kzak@redhat.com> 2.13.1-8
- fix location of the command raw(8) - fix location of the command raw(8)

View file

@ -0,0 +1,78 @@
From ced94242e11e2ac121c9dae5c707bac5b47e501a Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 7 Jul 2008 15:22:22 +0200
Subject: [PATCH] write: doesn't check for tty group
write(1) selects a wrong tty, because there is not a proper
check of tty group ownership:
$ write kzak
write: kzak is logged in more than once; writing to tty7
write: /dev/tty7: Permission denied
$ ls -la /dev/tty7
crw--w---- 1 root root 4, 7 2008-07-04 00:32 /dev/tty7
^^^^
$ ls -la /usr/bin/write
-rwxr-sr-x 1 root tty 11864 2008-04-02 16:24 /usr/bin/write
^ ^^^
We have to check for tty group owner, because we don't have
permissions to write to arbitrary tty.
Fixed version:
$ write kzak
write: kzak is logged in more than once; writing to pts/6
^^^^
Message from test@nb on pts/7 at 15:22 ...
^C
$ ls -la /dev/pts/6
crw--w---- 1 kzak tty 136, 6 2008-07-07 15:35 /dev/pts/6
^^^
Addresses-Red-Hat-Bugzilla: #454252
Signed-off-by: Karel Zak <kzak@redhat.com>
---
misc-utils/write.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/misc-utils/write.c b/misc-utils/write.c
index 46b8f0a..276fe96 100644
--- a/misc-utils/write.c
+++ b/misc-utils/write.c
@@ -72,6 +72,8 @@ static void done(int);
int term_chk(char *, int *, time_t *, int);
int utmp_chk(char *, char *);
+static gid_t myegid;
+
int
main(int argc, char **argv) {
time_t atime;
@@ -83,6 +85,8 @@ main(int argc, char **argv) {
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ myegid = getegid();
+
/* check that sender has write enabled */
if (isatty(fileno(stdin)))
myttyfd = fileno(stdin);
@@ -267,7 +271,9 @@ int term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
"write: %s: %s\n", path, strerror(errno));
return(1);
}
- *msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0; /* group write bit */
+
+ /* group write bit and group ownership */
+ *msgsokP = (s.st_mode & (S_IWRITE >> 3)) && myegid == s.st_gid;
*atimeP = s.st_atime;
return(0);
}
--
1.5.5.1